The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 305 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Below is a C program I am having trouble completing. Looking for help making the code work and the program functioning correctly.
Â
Â
/*The Jumpin' Java Bean coffee shop charges $2.00 for a cup of coffee and offers the add-ins shown in the table at the end of the lab. Use 2 parallel arrays.Â
Design the logic and write a C program that allows a user to enter ordered add-ins, by number not name, allow for multiple add-ons and a sentinal value to stop the add-on prompts. After each item, display its price or the message "Sorry, we do not carry that item" as output. After all items have been entered, display the total price for the order. Keep the program running for other customers until told to stop.
Product
Price
Whipped Cream
0.89
Cinnamon
0.25
Chocolate sauce
0.59
Amaretto
1.50
Irish whiskey
1.75*/
#include<stdio.h>
main()
{
   int    size = 5;
   int    coffeePrice = 2;
   char   product[size] = {"Whipped Cream", "Cinnamon", "Chocolate Sauce", "Amaretto", "Irish Whiskey"}; /*error variable sized object may not be initialized*/
   int    prices[size] = {.89, .25, .59, 1.5, 1.75};
   int    totalPrice = 0;
   int    choice = 0;
   int    sentinel = -1;
 while (choice <> sentinel)
 {
   printf("    Welcome to:");
   printf("n  ");
   printf("n    The Jumping Bean   ");
   printf("n    Menu:");
   printf("n    1. Whipped Cream $0.89");
   printf("n    2. Cinnamon $0.25");
   printf("n    3. Chocolate Sauce $0.59");
   printf("n    4. Amaretto $1.50");
   printf("n    5. Irish Whiskey $1.75");
   printf("n ");
   printf("n    Please Select and Enter Add-On Items using NUMBER of selection or -1 to Quit:");
   scanf(%d, choice);
 }
 if(choice <> -1);
)
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly