Learning Goal: I’m working on a c programming question and need a sample draft t

Learning Goal: I’m working on a c programming question and need a sample draft to help me learn.# write comments1. 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. The snacksare: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 /bag6. Energy drinks-$4.99/half dozenWrite 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 /bag6. Energy drinks -$4.99/half dozen enter selection: 1Enter number of boxes: 3Enter selection: 3Enter number of bags: 2Enter selection: 7Invalid selection, select from 1 to 6, enter 0 to stop selectionEnter selection: 6Enter number of drinks as multiples of six (6, 12, 18…): 24Enter selection: 5Enter number of bags: 1Enter selection: 0Cost per person($): 4.501)Name your program snacks.c2)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.Example 1:Input: “fall”Output: validExample 2:Input: “8littlepigs”Output: InvalidExample 3:Input: “CpE”Output: InvalidExample 4:Input: “CSE2021”Output: InvalidExample 5:Input: “CSE”Output: Valid
Requirements: not short not lonr

Leave a comment

Your email address will not be published. Required fields are marked *