Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Student Grading Using File I/O and Arrays The purpose of this assignment is to review the use of one-dimensional arrays, reading and writing text files,

Student Grading Using File I/O and Arrays

The purpose of this assignment is to review the use of one-dimensional arrays, reading and writing text files, writing functions, and program planning and development.

This program consist of two parts:

1) Part 1: read and process a student data file, and writing the results to a student report file

2) Part 2: add code to part 1 to calculate some statistics and write them to the end of student report file.

For this assignment, you will be reading one input file and writing out to an output file.

Part 1

Read in the student data file (HW1-data.txt), partially shown below. Each line of this file consists of a (8-digit numeric) student id, lab exercise points (50), 10 assignment's points (20 each), midterm points (60), final points (100), and CodeLab points (10). For coding, read the entire file assuming you do not know how many lines are in the file (no hard-coding of loop count). You will write the input student data and the results of the processing into a student report file HW1-output-XXXXX.txt that looks "just like" the output shown below. In addition to the input student data, the report should contain the "total" of the assignment grades, the total and percent of all points achieved, and the letter grade. You may assume that the input data file does not contain any errant data.

Points

Lab Exercises

50 points

10 HW

200 points

Midterm

70 points

Final

100 points

Extra Credit: CodeLab

10 points

Total used for percentage calculation : 420 (not including extra credit)

Grading Scale:

A 90% and up of total score

B 78% through 89% of total score

C 62% through 77% of total score

D 46% through 61% of total score

F 45% or less of total score

Input File

image text in transcribed

The Student Report Output File

image text in transcribed

Part 2

At the end of the previous report, add the code to write a summary report file that contains the average percent of total points for all students. Also, display the number of A's, B's, C's, D's and F's for the students. Your summary output file should look something like this:

Average total point percent of all students: ??

Number of A's = ??

Number of B's = ??

Number of C's = ??

Number of D's = ??

Number of F's = ??

Maximum points = ???

Program requirements

1. You must use at least 1 one-dimension array. Do not use 2 dimensional arrays - this will be covered in the another assignment.

2. Your solution must include at least 3 functions, counting the main() function. One function must include an array argument with a size argument. Place the function definitions below main() and function prototypes above main().

3. All files must be checked for a successful open.

4. Make sure you write the student id with a leading 0, if appropriate (i.e. the 7th id).

5. The percent of total points must be rounded to the nearest integer. For example, 94.1% becomes 94%, 85.8% becomes 86%, 75.5% is 76% (see cmath library)

6. The letter grade is determined by the "integer" percent.

7. Add headings to your output report file. They should be aligned and correctly identify the column data.

8. Do not use any global variable.

Student data file

99587442 40 11 12 18 10 15 11 19 14 15 19 57 93 4 69376571 48 14 19 19 20 19 19 16 18 20 8 40 68 5 83406759 46 16 18 4 14 16 19 20 12 14 7 57 71 10 68507434 41 20 17 20 18 11 18 12 19 6 17 47 80 8 68315319 50 6 14 19 19 19 18 9 16 17 20 53 81 9 85868414 48 20 19 14 14 13 15 19 20 20 13 59 94 6 01234567 48 16 20 14 18 14 18 16 15 15 16 57 85 8 94349760 48 20 17 12 12 18 17 17 20 8 5 33 68 8 49743198 46 9 19 20 15 8 16 19 11 17 14 69 38 7 49727845 45 18 13 8 19 18 6 15 15 13 12 61 39 6 63348737 41 11 20 20 6 13 19 19 15 17 8 66 67 10 92058829 43 20 7 12 17 17 5 19 15 19 5 63 41 4 76634646 43 17 7 20 18 15 10 13 16 11 12 52 51 8 92569684 27 15 16 3 20 6 19 7 19 20 6 30 27 9 77859185 46 20 19 7 10 15 12 14 17 18 12 56 80 9 96288488 18 16 20 20 7 11 15 17 10 14 11 67 83 6 43719431 10 19 18 18 13 18 19 20 18 15 16 62 54 9 93729985 33 19 18 16 18 12 20 8 19 14 20 67 89 9 81055197 28 14 7 10 13 18 3 13 20 19 15 39 63 9 75117670 48 20 13 15 20 20 15 17 18 19 3 39 39 4 82339627 22 17 13 18 13 4 13 14 16 20 7 69 67 7 76083210 37 12 11 15 17 17 13 11 18 20 9 67 76 4 56724636 38 18 18 20 16 16 12 16 18 16 19 68 96 9 95864348 48 20 4 20 14 13 11 18 15 20 20 55 99 7 81148779 33 15 13 14 14 19 20 11 16 16 12 63 97 4 52266012 36 14 16 15 20 18 13 14 20 19 2 52 72 8 57809572 45 6 19 20 5 19 5 5 19 18 14 70 96 7 73209724 40 19 15 15 7 20 18 13 9 15 15 54 56 10 74075368 27 17 14 20 13 14 20 16 11 12 19 56 90 6 35998165 44 18 20 18 18 16 10 18 15 17 18 54 83 8 59369118 33 8 19 19 19 15 19 17 14 16 17 45 76 3 98459005 39 17 18 16 12 18 10 13 19 16 7 49 92 4 92378153 34 20 12 10 20 16 5 12 16 11 20 64 51 5 72137258 35 6 15 18 16 17 18 18 7 15 17 56 77 3 80127661 22 19 19 17 14 19 18 19 15 14 8 18 93 10 89096607 37 19 17 8 16 16 3 20 11 18 17 67 85 9 56557465 26 20 14 8 16 19 17 19 12 18 12 18 76 8 89848685 34 15 6 7 13 12 19 19 11 12 6 54 99 6 66718189 48 11 12 16 17 20 6 19 14 12 19 67 26 1 74974049 38 11 19 19 15 16 17 18 20 20 13 68 90 10 80739909 12 16 20 14 19 15 15 8 17 18 12 67 93 9 88013992 34 4 18 10 20 19 16 10 8 14 19 45 98 10 30587366 47 18 11 19 19 6 17 19 17 15 17 42 72 9 49402614 39 9 18 20 19 3 13 18 19 16 8 44 83 8 22879177 34 13 20 11 13 11 16 11 20 14 15 61 67 2 57878135 43 13 13 11 11 16 14 18 15 19 19 62 73 7 76543210 29 3 10 10 10 15 10 15 10 15 10 50 71 0 76543211 19 0 15 10 10 15 10 15 10 15 10 50 70 0 87654321 46 20 19 20 19 20 19 20 19 20 19 68 98 9 50139080 40 20 20 15 16 13 20 4 20 11 5 62 95 8 

HW1-data.txt

99587442 40 11 12 18 10 15 11 19 14 15 19 57 93 4 69376571 48 14 19 19 20 19 19 16 18 20 8 40 68 5 83406759 46 16 18 4 14 16 19 20 12 14 7 57 71 10 68507434 41 20 17 20 18 11 18 12 19 6 17 47 80 8 68315319 50 6 14 19 19 19 18 9 16 17 20 53 81 9 85868414 48 20 19 14 14 13 15 19 20 20 13 59 94 6 01234567 48 16 20 14 18 14 18 16 15 15 16 57 85 8 94349760 48 20 17 12 12 18 17 17 20 8 5 33 68 8 49743198 46 9 19 20 15 8 16 19 11 17 14 69 38 7 49727845 45 18 13 8 19 18 6 15 15 13 12 61 39 6 63348737 41 11 20 20 6 13 19 19 15 17 8 66 67 10 92058829 43 20 7 12 17 17 5 19 15 19 5 63 41 4 76634646 43 17 7 20 18 15 10 13 16 11 12 52 51 8 92569684 27 15 16 3 20 6 19 7 19 20 6 30 27 9 77859185 46 20 19 7 10 15 12 14 17 18 12 56 80 9 96288488 18 16 20 20 7 11 15 17 10 14 11 67 83 6 43719431 10 19 18 18 13 18 19 20 18 15 16 62 54 9 93729985 33 19 18 16 18 12 20 8 19 14 20 67 89 9 81055197 28 14 7 10 13 18 3 13 20 19 15 39 63 9 75117670 48 20 13 15 20 20 15 17 18 19 3 39 39 4 82339627 22 17 13 18 13 4 13 14 16 20 7 69 67 7 76083210 37 12 11 15 17 17 13 11 18 20 9 67 76 4 56724636 38 18 18 20 16 16 12 16 18 16 19 68 96 9 95864348 48 20 4 20 14 13 11 18 15 20 20 55 99 7 81148779 33 15 13 14 14 19 20 11 16 16 12 63 97 4 52266012 36 14 16 15 20 18 13 14 20 19 2 52 72 8 57809572 45 6 19 20 5 19 5 5 19 18 14 70 96 7 73209724 40 19 15 15 7 20 18 13 9 15 15 54 56 10 74075368 27 17 14 20 13 14 20 16 11 12 19 56 90 6 35998165 44 18 20 18 18 16 10 18 15 17 18 54 83 8 59369118 33 8 19 19 19 15 19 17 14 16 17 45 76 3 98459005 39 17 18 16 12 18 10 13 19 16 7 49 92 4 92378153 34 20 12 10 20 16 5 12 16 11 20 64 51 5 72137258 35 6 15 18 16 17 18 18 7 15 17 56 77 3 80127661 22 19 19 17 14 19 18 19 15 14 8 18 93 10 89096607 37 19 17 8 16 16 3 20 11 18 17 67 85 9 56557465 26 20 14 8 16 19 17 19 12 18 12 18 76 8 89848685 34 15 6 7 13 12 19 19 11 12 6 54 99 6 66718189 48 11 12 16 17 20 6 19 14 12 19 67 26 1 74974049 38 11 19 19 15 16 17 18 20 20 13 68 90 10 80739909 12 16 20 14 19 15 15 8 17 18 12 67 93 9 88013992 34 4 18 10 20 19 16 10 8 14 19 45 98 10 30587366 47 18 11 19 19 6 17 19 17 15 17 42 72 9 49402614 39 9 18 20 19 3 13 18 19 16 8 44 83 8 22879177 34 13 20 11 13 11 16 11 20 14 15 61 67 2 57878135 43 13 13 11 11 16 14 18 15 19 19 62 73 7 76543210 29 3 10 10 10 15 10 15 10 15 10 50 71 0 76543211 19 0 15 10 10 15 10 15 10 15 10 50 70 0 87654321 46 20 19 20 19 20 19 20 19 20 19 68 98 9 50139080 40 20 20 15 16 13 20 4 20 11 5 62 95 8 
99587442 40 11 12 18 10 15 11 19 14 15 19 57 93 4 69376571 48 14 19 19 20 19 19 16 18 20 8 40 68 5 83406759 46 16 18 4 14 16 19 20 12 14 7 57 71 10 68507434 41 20 17 20 18 11 18 12 19 6 17 47 80 8 68315319 50 6 14 19 19 19 18 9 16 17 20 53 81 9 85868414 48 20 19 14 14 13 15 19 20 20 13 59 94 6 01234567 48 16 20 14 18 14 18 16 15 15 16 57 85 8 94349760 48 20 17 12 12 18 17 17 20 8 5 33 68 8 9743198 46 9 19 20 15 8 16 19 11 17 14 69 38 7 49727845 45 18 13 8 19 18 6 15 15 13 12 61 39 6 99587442 40 11 12 18 10 15 11 19 14 15 19 57 93 4 69376571 48 14 19 19 20 19 19 16 18 20 8 40 68 5 83406759 46 16 18 4 14 16 19 20 12 14 7 57 71 10 68507434 41 20 17 20 18 11 18 12 19 6 17 47 80 8 68315319 50 6 14 19 19 19 18 9 16 17 20 53 81 9 85868414 48 20 19 14 14 13 15 19 20 20 13 59 94 6 01234567 48 16 20 14 18 14 18 16 15 15 16 57 85 8 94349760 48 20 17 12 12 18 17 17 20 8 5 33 68 8 9743198 46 9 19 20 15 8 16 19 11 17 14 69 38 7 49727845 45 18 13 8 19 18 6 15 15 13 12 61 39 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What are five examples of customer-focused behavior?

Answered: 1 week ago

Question

=+ Where do we want to go?

Answered: 1 week ago