SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 06 Jan 2018 My Price 7.00

C program I am having trouble completing

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);

)

}

Answers

(5)
Status NEW Posted 06 Jan 2018 02:01 PM My Price 7.00

-----------  ----------- 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

Not Rated(0)