{"id":49852,"date":"2021-09-11T19:53:32","date_gmt":"2021-09-11T19:53:32","guid":{"rendered":"https:\/\/papersspot.com\/blog\/2021\/09\/11\/2-program-design\/"},"modified":"2021-09-11T19:53:32","modified_gmt":"2021-09-11T19:53:32","slug":"2-program-design","status":"publish","type":"post","link":"https:\/\/papersspot.com\/blog\/2021\/09\/11\/2-program-design\/","title":{"rendered":"2 program design"},"content":{"rendered":"<p># write comments <br \/>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. <br \/>The snacksare: <br \/>1. Energy bars-$3.99\/box, <br \/>2. Candy bars-$2.39 \/box, <br \/>3. Chips -$4.79\/bag, <br \/>4. Pretzels-$2.99\/bag, <br \/>5. Popcorns-$3.50 \/bag <br \/>6. Energy drinks-$4.99\/half dozen <br \/>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. <br \/>An example input\/output: Please select from the list: <br \/>1. Energy bars -$3.99 \/box, <br \/> 2. Candy bars -$2.39 \/box, <br \/>3. Chips -$4.79 \/bag, <br \/>4. Pretzels -$2.99\/bag, <br \/>5. Popcorns -$3.50 \/bag <br \/>6. Energy drinks -$4.99\/half dozen <br \/>enter selection: 1 <br \/>Enter number of boxes: 3 <br \/>Enter selection: 3 <br \/>Enter number of bags: 2 <br \/>Enter selection: 7 <br \/>Invalid selection, select from 1 to 6, enter 0 to stop selection <br \/>Enter selection: 6 <br \/>Enter number of drinks as multiples of six (6, 12, 18&#8230;): 24 <br \/>Enter selection: 5 <br \/>Enter number of bags: 1 <br \/>Enter selection: 0 <br \/>Cost per person($): 4.50 <br \/>1)Name your program snacks.c <br \/>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. <br \/>3)Use a switch statement to compute the amount due according to the selection(s). <br \/>4)Format the output to two decimal digits. <\/p>\n<p>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: <br \/>1. All letters are capitals, like \u201cUCLA\u201d, <br \/> 2. All letters are not capitals, like \u201cprogram\u201d. Write a program that prompts the user to enter a word. The program determines if the input is a valid word or invalid. <br \/> 1)Name your program word.c. <br \/>2)The user input ends with the user pressing the enter key (a new line character). <br \/>3)Use getchar() to read in the input. Character handling functions are allowed. <br \/>Example 1: <br \/>Input: \u201cfall\u201d <br \/>Output: valid <br \/>Example 2: <br \/>Input: \u201c8littlepigs\u201d <br \/>Output: Invalid <br \/>Example 3: <br \/>Input: \u201cCpE\u201d <br \/>Output: Invalid <br \/>Example 4: <br \/>Input: \u201cCSE2021\u201d <br \/>Output: Invalid <br \/>Example 5: <br \/>Input: \u201cCSE\u201d <br \/>Output: Valid <\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p># 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. 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 \/bag 6. Energy drinks-$4.99\/half dozen Write a program to calculate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-49852","post","type-post","status-publish","format-standard","hentry","category-research-paper-writing","tag-programming"],"_links":{"self":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/49852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/comments?post=49852"}],"version-history":[{"count":0,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/49852\/revisions"}],"wp:attachment":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/media?parent=49852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/categories?post=49852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/tags?post=49852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}