Question: Part A (79 points) Algorithm solution (in pseudocode): 1. Declare variable inFile to get the data from an input file 2. Declare variables grade, counter,

 Part A (79 points) Algorithm solution (in pseudocode): 1. Declare variable
inFile to get the data from an input file 2. Declare variables

Part A (79 points) Algorithm solution (in pseudocode): 1. Declare variable inFile to get the data from an input file 2. Declare variables grade, counter, and total that hold a whole numbers. 3. Declare and initialize to zero a variable named sum that hold a whole numbens 4. Open file input9.txt 5. Check if the file was opened (Gf not opened, show an error message and stop the program). 6. Prompt the user to enter the number of grades to process. 7. Get the value from the keyboard and store it in total. 8. Check if the value entered is outside the range (1.. .100). If the value is outside the range, display an error message and stop the program. 9. Set counter to 0. 10. While (counter is less than total) 11. Get the value from the file and store it in grade. 12. Accumulate its value in sum. 13. Increment the counter. 14. Print the "The average is" followed by the value returned by the function average (sum,total). 15. Closes the file Function average() receives the values of sum and total. calculates the average, and rounds it to the nearest whole number (ones) before returning it. Use appropriate type casting to avoid loss of information when calculating the average. Part B (10 points) Repeat steps 9 through 13 so that the loop is implemented with a for-loop. The while loop is the only section that should be commented out. Part C (11 points) Modify steps 6 through 8 in the above program so that, instead of stopping the program, it keeps asking the user to enter a valid value until it is entered. Note: use a do-loop. See my sample solution to see what your program must do. To clear the screen before prompting the user to enter the value use system("els");. To pause your program so the user can read your message use system(pause" Add to step 12 another average (use sum2 and total2). so that only the passing grades (70 through 100) are considered to calculate the average. Be careful here when you calculate the average since

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!