Question: java Integers numLobsters and myMoney are read from input. A lobster costs 1 0 dollars. If numLobsters is less than 3 , then output Not

java Integers numLobsters and myMoney are read from input. A lobster costs 10 dollars.
If numLobsters is less than 3, then output "Not enough lobsters."
If numLobsters is greater than or equal to 3, then declare and initialize int variable totalCost with the product of numLobsters and 10.
If totalCost is less than or equal to myMoney, then output "Successful purchase!"
Otherwise, output "Not enough money to buy all."
If myMoney is greater than or equal to 10, then output "At least one item was purchased."
If numLobsters is greater than 22, then output "Now out of stock."
End each output with a newline.
Click here for examples
Ex 1: If the input is 282, then the output is:
Not enough lobsters.
Ex 2: If the input is 63690, then the output is:
Successful purchase!
At least one item was purchased.
Now out of stock.
Ex 3: If the input is 71593, then the output is:
Not enough money to buy all.
At least one item was purchased.
Now out of stock.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!