Details of this Paper

Assignment 3 Reading from a File and using a multi-dimensional array

Description

solution


Question

Assignment 3: Reading from a File and using a multi-dimensional array;Write a C program to read from a file called "input.txt" information about 5 workers. Each line of input would contain two values respectively, an employee ID and the employee's monthly salary.;Assume that the data from the input file is stored in a format as shown in this example. Note: for testing purposes, the following data may not necessarily be used. It is just to give you an idea of the format of the data;Sample contents of input.txt;10 2000;20 6800;30 9700;40 1500;50 8000;Store the employee information into a 2D array. Assume that the data types are as follows: id (integer data type) and income (integer data type).;Read the information and store the 5 employee records into the 2D array.;Use a function that prints the sum of all income of workers.;Create another function that prints the number of workers who has an income of greater than $5000 and also the ID and income of each worker who has an income of greater than $5000.;Sample output printed to the screen;Sum of all incomes: $24500;3 Workers have an income of greater than $5000;20 $6800, 30 $9700, 50 $8000;Marking scheme for all assignments:... Appropriately documented and readable code..................... 2 marks... User friendly program design........................................... 4 marks... Approach to the problem and use of appropriate techniques.. 6 marks... Program compiles, works and meets objectives................... 8 marks;TOTAL............................................................................. 20 MARKS;All program code must be compiling, working and properly commented to indicate the approach taken to the problem.;Please remember coding must be c and not c++. Program must be working and compiling in DEV C++ programming software. You can provide a link where I can downland the file or just copy and paste the code where I will test it and see that it is working.;I will tip high once working.;Example to read from a file. what I learn from class;#include;int main();FILE *in, *out;int j, n, l;int sum = 0;in = fopen("input.dat", "r");out = fopen("C:\Users\ICT Technician\Documents\Roytech ADISM Course Stuff\Structured Programming Techniques - INFO 0203\Wed 18th Questions\\Intergers Folder\\interger_out.dat", "w");for (j=0, j<8,j++);fscanf(in, "%d%d", &&n, &l);printf("%3d%3d", n, l);sal = n * 5;fprintf(out, "\nSalary is %d x %d = %d\n", n, l, sal);fclose(in);fclose(out);return 0;Optional Information;Language (or Software): Other;Already Tried;Need help and to get this done for Thursday 10th July by 3:00 pm. Latest Friday 11TH July by 12:00 PM. (Greenwich Mean Time (GMT-4))Must compile in DEV C++ Software. Please remember coding must be c and not c++. Program must be working and compiling in DEV C++ programming software. You can provide a link where I can downland the file or just copy and paste the code where I will test it and see that it is working

 

Paper#67225 | Written in 18-Jul-2015

Price : $37
SiteLock