Question: MUST HAVE 4 FUNCTIONS! You are to write a program that will compute a student's grade. The input will be a student's name, a first
MUST HAVE 4 FUNCTIONS!
You are to write a program that will compute a student's grade. The input will be a student's name, a first and a last name, followed by four (4) grades. Each test has a different weight, so you will also read the weight of each test. The weight is a percentage that the current grade used in computing the final average. Each input grade will have a weight immediately following grade.
Your output will be the student's name, last name listed first, followed by a comma (,) followed by the student's first name, followed by a numeric average (accurate to one decimal point) followed by a letter grade.
Example input:
Tommy Mixon 90 20% 85 20% 90 20% 88 40%
Example output:
Mixon, Tommy 88.2 B
Your input file is WhatsMyGrade Data.txt . You must use functions; one to read a name (call twice), one to read a grade and percent value, one to calculate the percent of grade, and one to print results.
Hints:
The name is made up of two strings, so you read into two string variables (FirstN LastN). You will read a grade (one variable) then the percentage (one variable) then read the '%' character. You don't need to use or save the % character; it is just in the way for input. But I like the % sign in the input. The percentage needs to be divided by 100 for scaling the grade, (grade * percentage) for each grade. Add the four values together and you will have the student's average (no dividing by 4 here.) The last entry is 'Done' and is a sentinel value indicating this is the end of data.
OUTPUT NEEDS TO LOOK IDENTICAL
Sample data below. Your program continues to run (loop) until 'Done' is entered.
Moto Hasee 85 25% 80 25% 90 15% 95 35%
Shoe Tinney 70 10% 80 20% 85 25% 89 45%
Jam Toe 95 25% 85 30% 90 20% 95 25%
Done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
