In Java, is there a simple way of doing this without having to use so many If statements? please explain A client wants to purchase drinks for an event they are arranging. Write a program that asks them how much money they have to spend and whether alcohol would be allowed at the event. Then show them their choices from the following list, but 1) only show drinks that they can afford to buy at least 1 of, 2) only show alcoholic drinks if they are allowed at the event, and 3) show how many of each drink they could afford. If the user enters an invalid or negative value for their budget or an invalid response for whether alcohol is allowed, it should indicate an error and let the user try again. The possible drink choices are: Bottle of Water: $0.50 Soda: $1.50 Tea: $3.00 Beer (alcoholic): $5.00 Wine (alcoholic): $20.00
In Java, is there a simple way of doing this without having to use so many If statements? please explain
A client wants to purchase drinks for an event they are arranging. Write a program that asks them how much money they have to spend and whether alcohol would be allowed at the event. Then show them their choices from the following list, but 1) only show drinks that they can afford to buy at least 1 of, 2) only show alcoholic drinks if they are allowed at the event, and 3) show how many of each drink they could afford. If the user enters an invalid or negative value for their budget or an invalid response for whether alcohol is allowed, it should indicate an error and let the user try again. The possible drink choices are: Bottle of Water: $0.50 Soda: $1.50 Tea: $3.00 Beer (alcoholic): $5.00 Wine (alcoholic): $20.00
Trending now
This is a popular solution!
Step by step
Solved in 9 steps with 7 images