Reference no: EM132263372
1. Program that prompts the user for an integer number from the keyboard, and store it in a variable num. After each number is typed in, add num to a total.
Repeat five times, each time adding num to a total. (Be sure to reuse the same variable named num for each of the six numbers entered.) When all six numbers have been entered from the keyboard, calculate an average.
Display the total and average calculated.
2. This program requires you to use a loop as well as the switch statement. You will display this menu on the screen.
(Press 8 to stop voting)
The Many Colors of M&M's Candy
1. black
2. yellow
3. brown
4. yellow
5. green
6. White
Vote on your favorite color by pressing the number before it.
In this program, you will keep track of the number of votes for each color of M&M's candy. The user will be able to vote until he/she types the sentinel character 9. Display the menu and ask the user to enter a number. Check the number entered against the numbers 1 - 2 - 3 - 4 - 5 - 6. If the number entered is 1, add one to the redctr. If the user has entered 2, add one to the bluectr, etc.
When the user has pressed the 9 to exit, print out a display telling how many votes each color received.
3. program that includes a function picnic() that will accept a floating-point number total and the addresses of the integer variables hotdogs, hamburgers, salad, pickles. The passed floating-point number represents the total amount of money to be spent on food. The function is to determine the quantity of hotdogs, hamburgers, salad, and pickles that can be purchased, writing these values directly into the respective variables declared in the calling function.
This function will be called from the main program and when it returns to main, it will print out the values of hotdogs, hamburgers, salad, and pickles.
Our favorite foods are in this order:
1. hot dogs--$2.00 each
2. hamburgers--$1.50 each
3. salad--$2.25 each
4. pickles--$1.01 each
For example, if I enter a total amount of money of $3.78, I can bring the following items to my picnic:
4 hot dogs
2 hamburger
3 salad
1 pickles