Question: Need help on the lab assignment. Thank you Your task: implement in C++ the algorithm solution shown below. Then analyze it and explain, using ju

Need help on the lab assignment. Thank you
 Need help on the lab assignment. Thank you Your task: implement
in C++ the algorithm solution shown below. Then analyze it and explain,

Your task: implement in C++ the algorithm solution shown below. Then analyze it and explain, using ju one or two sentences, what it does. Write this explanation as a comment at the top of your program. Th explanation will be worth 5 points of your total grade. Do not be too detailed (for example, do not writ it opens a file and then declares var s, and then reads from a file...);, it should look like the probler descriptions in my previous lab assignuents. 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 numbers. 4. Open file input9.txt 5. Check if the file was opened (if 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. 12Accumulate its value in sum. 13. Increment the counter 14. Print the "The average is ", followed by the value retumed 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) Modify steps 9 through 13 so that the loop is implemented with a for-loop. 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(tcls). To pause your program so the user ean read your message use systempause"s Modify step 12. so that only the passing grades (70 through 100) are considcred to calculate the everage. Be careful here when you calculate the average since there might be no passing grades among those

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!