Part1: • Write a program that presents to the users a choice of your 4 favorite beverages (Water, Milk, Juice, and Coffee). • Then allow the user to choose a beverage by entering a number froml to 4. • Output the name of which beverage they chose. • Modify the program so that if the user enters a choice other than 1-4 then it will output "Invalid choice." and asks him again to enter a new choice.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I want to solve the question in c++ please

That each part be alone

 

Exercise 5

Part1:

• Write a program that presents to the users a choice of your 4 favorite beverages (Water, Milk, Juice, and Coffee).

. Then allow the user to choose a beverage by entering a number from1 to 4. Output the name of which beverage they chose. .

. Modify the program so that if the user enters a choice other than 1-4 then it will output "Invalid choice." and asks him again to enter a new choice.

 

=========================================

 

Part 2:

Modify your program to make the user enter a quantity of the chosen drink. If the

user enters quantity outside of the range [1.5] then the program will output

"Invalid quantity." and asks him again to enter a new quantity. Knowing that drink prices are respectively. 1 SAR, 1.5 SAR, 2 SAR, and 1.75 SAR, .

print the total amount that the user should pay.

CCIS
Exercise 5
Part1:
• Write a program that presents to the users a choice of your 4 favorite beverages
(Water, Milk, Juice, and Coffee).
• Then allow the user to choose a beverage by entering a number from1 to 4.
• Output the name of which beverage they chose.
Modify the program so that if the user enters a choice other than 1-4 then it will
output "Invalid choice." and asks him again to enter a new choice.
Part 2:
• Modify your program to make the user enter a quantity of the chosen drink. If the
user enters quantity outside of the range [1,5] then the program will output
"Invalid quantity." and asks him again to enter a new quantity.
• Knowing that drink prices are respectively: 1 SAR, 1.5 SAR, 2 SAR, and 1.75 SAR,
print the total amount that the user should pay.
Part 3:
• Modify your program to ask the user to enter the amount of money first.
• Then he makes his choice and quantity.
• If the money entered is less than the total amount, print "You cannot buy this quantity
of drinks" otherwise, print the total amount and the remaining money
Transcribed Image Text:CCIS Exercise 5 Part1: • Write a program that presents to the users a choice of your 4 favorite beverages (Water, Milk, Juice, and Coffee). • Then allow the user to choose a beverage by entering a number from1 to 4. • Output the name of which beverage they chose. Modify the program so that if the user enters a choice other than 1-4 then it will output "Invalid choice." and asks him again to enter a new choice. Part 2: • Modify your program to make the user enter a quantity of the chosen drink. If the user enters quantity outside of the range [1,5] then the program will output "Invalid quantity." and asks him again to enter a new quantity. • Knowing that drink prices are respectively: 1 SAR, 1.5 SAR, 2 SAR, and 1.75 SAR, print the total amount that the user should pay. Part 3: • Modify your program to ask the user to enter the amount of money first. • Then he makes his choice and quantity. • If the money entered is less than the total amount, print "You cannot buy this quantity of drinks" otherwise, print the total amount and the remaining money
Expert Solution
steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education