I want to solve the question in c++ please   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.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 28PE
icon
Related questions
icon
Concept explainers
Question

I want to solve the question in c++ please

 

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.

CIS
Irau
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:CIS Irau 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 1 images

Blurred answer
Knowledge Booster
Operators
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT