Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have a program in computing where i have to read a list of students and their grades from an input file and calculate each

i have a program in computing where i have to read a list of students and their grades from an input file and calculate each studen't average, then copy the information into a new output file. i'm stuck at the moment.the instructions are:

Write a program to compute average grades for a course. The course records are in a single file (named quiz.txt) and are organized according to the following format: Each line contains a students first name, then one space, then the students last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program will read data from this file and write its output to a second file. The data in the output file (named average.txt) will be nearly the same as the data in the input file except that you will print the names as last_name, first_name; each quiz score, and there will be one additional number at the end of each line: the average of the students ten quiz scores. The output file must be formatted as described below: (1) The output file should contain a line (or lines) at the beginning of the file providing appropriate column headings. Use formatting statements to make the layout clean and easy to read. (2) first and last names appear together in a left justified column that is 20 characters wide where the last name comes first, then a comma and a space and then the first name. Read each name separately and then put them together into a larger correctly formatted string before trying to output them. (3) Each quiz score should be listed in a right justified column that is 4 characters wide. Note that if a student has fewer than 10 scores (they have missed one or more of the quizzes), your program will need to display the missing score(s) using 0 or empty space(s) for each one. (4) The average should appear in its own right justified column that is 10 characters wide. Note that if a student has fewer than 10 scores, the average is still the sum of the quiz scores divided by 10.

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

More Books

Students also viewed these Databases questions