Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you will write a program in C++ that uses files and nested loops to create a file from the quiz grades entered

In this assignment, you will write a program in C++ that uses files and nested loops to create a file from the quiz grades entered by the user, then read the grades from the file and calculates the average quiz grade for a class. Each student takes 4 quizzes. Use a nested loop to write each students quizzes to a file. Then read the data from the file in order to display the students average score and the class average. Also write the program in Raptor. Input the data into the Raptor program during runtime. Do not use files for the Raptor program. Enter 5 items for each student. Column 1 is the student ID and Column 2?5 are the quiz grades. Student id Quiz 1 Quiz 2 Quiz 3 Quiz 4 1000 90 100 80 100 1001 85 95 85 100 1002 50 60 70 100 Requirements: 1. Use a nested loop structure to input the data and Write the data to a text file. a. The outer loop will be a while loop; the inner loop will be a for loop (4 quizzes). b. Validate whether the quiz scores are in range (0?100). c. Since you do not know how many students will be entered, add a way to quit the loop. d. Add spaces in between each item added to the text file. Add a new line after each student. The text file that your program creates will look like the following 2. Use a nested loop structure to read the data from the text file and calculate the students average grade. a. The outer look will be a while loop; the inner loop will be a for loop (4 quizzes) b. To calculate each students average score, use a total variable initialized to 0 before the for loop, then calculate the students average after the loop. c. To calculate the class average, initialize a classTotal variable to 0 before the while loop, add each students total into the classTotal following the for loop, then calculate the classAverage after the while loop. d. Only display 2 decimals for the averages. 3. BEWARE of integer division. 4. Use cout to output the values of the variables to the console. Your cout statement MUST use the variables to display the values 5. Output must be labelled and easy to read as shown in the sample output below. 6. Program must be documented with the following: a. // Name 2 b. // Date c. // Program Name d. // Description 7. Write the program in Raptor. Input the data during run time.

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

Question

What is the central issue of the situation facing the organization?

Answered: 1 week ago