write a program that presents to the users a choice of your 4 favorite beverages (water, milk, juice and coffee) 2)Then allows the user to choose a beverage by chose. Use switch display the choice, 3)modify the program so that if the user enters a choice other than 1,2,3 and 4 then it will output "invalid choice" 4) 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" knowing that drink prices are respectively: 1 $, 1.5 $, 2$ and 1.7 $ print the total amount that the user should pay. 5) modify your program to ask the user to enter the amount of money first. 6) then they makes their choice and quantity. 7) if the money entered is less than the total amount, print " you can't buy this quantity of the chosen drink" otherwise, print the total amount and the remaining money.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 5E: a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered...
icon
Related questions
Question
100%

((Java code))1) write a program that presents to the users a choice of your 4 favorite beverages (water, milk, juice and coffee)

2)Then allows the user to choose a beverage by chose. Use switch display the choice,

3)modify the program so that if the user enters a choice other than 1,2,3 and 4 then it will output "invalid choice"

4) 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" knowing that drink prices are respectively: 1 $, 1.5 $, 2$ and 1.7 $ print the total amount that the user should pay.

5) modify your program to ask the user to enter the amount of money first.

6) then they makes their choice and quantity.

7) if the money entered is less than the total amount, print " you can't buy this quantity of the chosen drink" otherwise, print the total amount and the remaining money.

thank you 

Part 1:
Write a Java 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 from 1 to 4.
• Output the name of which beverage they chose. Use switch to display the choice.
• Modify the program so that if the user enters a choice other than 1,2,3, and 4 then it will
output "Invalid 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."
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 the chosen drink" otherwise, print the total amount and the remaining money.
Transcribed Image Text:Part 1: Write a Java 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 from 1 to 4. • Output the name of which beverage they chose. Use switch to display the choice. • Modify the program so that if the user enters a choice other than 1,2,3, and 4 then it will output "Invalid 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." 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 the chosen drink" otherwise, print the total amount and the remaining money.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 8 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT