Question
You are responsible for tracking the progress of a junior-high fundraiser. You decide to have a C# program which will help you with the task.
You are responsible for tracking the progress of a junior-high fundraiser. You decide to have a C# program which will help you with the task.
I need a console program where I will implement variables that are needed for this program and will implement the code entirely within Main.
Prompt the user for contributions. It should first ask for the contributor's grade.
You should then it should ask how much the student is contributing.
These prompts should be placed inside of a loop so that the program will continue to ask for contributions until a value of 999 is entered for the contributor's grade.
Once that value is entered, the program should calculate the average value of the contributions.
Display the results, with a congratulatory message for the class which collected the largest amount.
Use a Boolean variable to control the while loop
Use a switch statement to help get the input into the proper variables
Place the switch statement within the while loop and use the Boolean variable to control the loop and set its value to false when the sentinel value (999) is detected.
When calculating the averages you will need a selection statement for each grade contribution to either compute the individual grade contribution average or to set it to zero if there were no contributions for that grade.
The output will look like the following:
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
6
Please enter the amount of the contribution:
10.99
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
6
Please enter the amount of the contribution:
100.50
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
7
Please enter the amount of the contribution:
75.00
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
7
Please enter the amount of the contribution:
80
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
8
Please enter the amount of the contribution:
44.50
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
8
Please enter the amount of the contribution:
77.77
Please enter the grade of the contributor (6, 7, or 8)
(enter 999 to quit):
999
Grade Level # of Contrib Total Amount Average
6th Grade 2 $111.49 $55.75
7th Grade 2 $155.00 $77.50
8th Grade 2 $122.27 $61.14
Congratulations 7th graders!
Press any key to continue . . .
C# program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started