Question: In Java please Integers numSalads and dollars are read from input. A salad costs 9 dollars. If numSalads is less than 5, output Please purchase
In Java please Integers numSalads and dollars are read from input. A salad costs 9 dollars. If numSalads is less than 5, output "Please purchase at least 5." If numSalads is greater than or equal to 5, then declare and initialize int variable totalCost with the product of numSalads and 9. If totalCost is less than or equal to dollars, output "Salads successfully purchased." Otherwise, output "Not enough money to buy all." If dollars is greater than or equal to 9, output "At least one item was purchased."
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
