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.
((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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fafe3fdfc-b680-404d-883d-ae27b13c5106%2Fc45c98a5-5de0-4d2f-bcba-a2d8c855d1b9%2F2no3szn_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 8 images









