Question

The Jumpin Jive coffee shop charges $2 for a cup of coffee and offers add ins...

The Jumpin Jive coffee shop charges $2 for a cup of coffee and offers add ins shown in the pseudocode. Using the following Pseudocode, Design the logic for an application that allows a user to enter ordered add ins continuously until a sentinel value is entered. After each item, display its price or the message "Sorry, we do not carry that" as an output. After all items have been entered, display the total price for the order. Please write it in C++ language.

//Start

// Delcarations

// num SIZE = 5

// num COFFEEPRICE = 2.00

// string products[SIZE] = "whipped cream", Cinnamon", "Chocolate Sauce", "Amaretto", "Irish whiskey"

// num prices[Size] = .89, .25, .59, 1.5, 1.75

// num totalPrice = 0

// num choice = 0

// num SENTINEL = -1

// while (choice <> SENTINEL)

// output " Please select an item from the product menu by selecting the item number (1-5) or -1 to terminate: "

// output " Product Price ($)"

// output " ====== ====="

// output "1. Whipped cream 0.89"

// output "2. Cinnamon 0.25"

// output "3. Chocolate sauce 0.89"

// output "4. Amaretto 1.50"

// output "5. Irish whiskey 1.75"

// output "Please enter a positive number: "

// input choice // if (choice <> -1) then

// if ((choice >= 1) and (choice <= 5)) then

// totalPrice = totalPrice + prices[choice-1]

// output "Item number ", choice,": ", products[choice-1], " has been added"

// else // output "Item number ",choice, " is not valid", "Sorry we do not carry that item"

// endif

// endif

// endwhile

// totalPrice = totalPrice + COFFEEPRICE

// output "Total price of order is ",totalPrice

// output "Thanks for purchasing from Jumpin Jive Coffee Shop" // Stop

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

   int main()
   {
// Delcarations

const int SIZE = 5;

double COFFEEPRICE = 2.00;

string products[SIZE] = {"whipped cream", "Cinnamon", "Chocolate Sauce", "Amaretto", "Irish whiskey"};

double prices[SIZE] = {.89, .25, .59, 1.5, 1.75};

double totalPrice = 0;

int choice = 0;

int SENTINEL = -1;


while (choice!=SENTINEL)
{
cout<<"\nPlease select an item from the product menu by selecting the item number (1-5) or -1 to terminate: "<<endl;  
cout<<"\nProduct\t\tPrice ($)"<<endl;

cout<<" =======\t\t====="<<endl;

cout<<setw(20)<<left<<"1. Whipped cream"<<setw(5)<<right<<"0.89"<<endl;

cout<<setw(20)<<left<<"2. Cinnamon"<<setw(5)<<right<<"0.25"<<endl;

cout<<setw(20)<<left<<"3. Chocolate sauce"<<setw(5)<<right<<"0.89"<<endl;

cout<<setw(20)<<left<<"4. Amaretto"<<setw(5)<<right<<"1.50"<<endl;

cout<<setw(20)<<left<<"5. Irish whiskey"<<setw(5)<<right<<"1.75"<<endl;
cout<<"Please enter a positive number: ";
cin>>choice;
if(choice>=1 && choice<=5)
{
totalPrice = totalPrice + prices[choice-1];  
cout<<"Item number ,"<< choice<<": "<< products[choice-1] <<" has been added"<<endl;
}
else if(choice>5)
{
cout<<"Item number ,"<<choice <<", is not valid, Sorry we do not carry that item"<<endl;  
}


}

totalPrice = totalPrice + COFFEEPRICE;
cout<<"Total price of order is ,"<<totalPrice<<endl;
cout<<"Thanks for purchasing from Jumpin Jive Coffee Shop"<<endl;

return 0;      
}

___________________________

output:

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
The Jumpin Jive coffee shop charges $2 for a cup of coffee and offers add ins...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to...

    Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write...

  • 5 5 - Parallel Arrays in Python Mind Tap - Cengage Lea x + V A...

    5 5 - Parallel Arrays in Python Mind Tap - Cengage Lea x + V A https//ng.cengage.com/static/nb/ui/evo/index.html?deploymentid=5745322406056533358933471518eISBN=9781337274509&id=586434 145&snapshotld: L x ... € → O 1 » CENGAGE MINDTAP Q Search this course x Parallel Arrays in Python D Parallel Lists Jumpinjive.py + > Terminal + 1 # Jumpin Java.py - This program looks up and prints the names and prices of coffee orders. 2 # Input: Interactive 3 # Output: Name and price of coffee orders or error message if...

  • I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For...

    I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For Loop) Logic Technical College has a current tuition of $10,000 per year. Tuition is scheduled to increase by 5% each year. Using a FOR loop, design a program that calculates and displays the tuition each year for the next ten years, like so: The tuition for year 1 will be: 10500.00 The tuition for year 2 will be: 11025.00 ……….. (You, of course will...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT