# write comments
1. Maggie is planning for a trip for her and her friends. The group decided to purchase snacks together and split the cost. There are10peoplein total.
1. Energy bars-$3.99/box,
2. Candy bars-$2.39 /box,
3. Chips -$4.79/bag,
5. Popcorns-$3.50 /bag
6. Energy drinks-$4.99/half dozen
Write a program to calculate the cost per person. The program allows the user to select an item, input the number of items, and calculate the cost per person.
An example input/output: Please select from the list:
1. Energy bars -$3.99 /box,
2. Candy bars -$2.39 /box,
3. Chips -$4.79 /bag,
4. Pretzels -$2.99/bag,
5. Popcorns -$3.50 /bag
6. Energy drinks -$4.99/half dozen
enter selection: 1
Enter number of boxes: 3
Enter selection: 3
Enter number of bags: 2
Enter selection: 7
Invalid selection, select from 1 to 6, enter 0 to stop selection
Enter selection: 6
Enter number of drinks as multiples of six (6, 12, 18…): 24
Enter selection: 5
Enter number of bags: 1
Enter selection: 0
Cost per person($): 4.50
1)Name your program snacks.c
2)If the user selects a number out of the range (1 through 6), display a message and allows the user to select again. When user enters 0, the program should exit from the loop for selection.
3)Use a switch statement to compute the amount due according to the selection(s).
4)Format the output to two decimal digits.
Program 2. In this program, we define a word to be valid if all characters of the word are alphabetic letters and one of following conditions holds:
1. All letters are capitals, like “UCLA”,
2. All letters are not capitals, like “program”. Write a program that prompts the user to enter a word. The program determines if the input is a valid word or invalid.
1)Name your program word.c.
2)The user input ends with the user pressing the enter key (a new line character).
3)Use getchar() to read in the input. Character handling functions are allowed.