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 dollars.
If numLobsters is less than then output "Not enough lobsters."
If numLobsters is greater than or equal to then declare and initialize int variable totalCost with the product of numLobsters and
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 then output At least one item was purchased."
If numLobsters is greater than then output "Now out of stock."
End each output with a newline.
Click here for examples
Ex : If the input is then the output is:
Not enough lobsters.
Ex : If the input is then the output is:
Successful purchase!
At least one item was purchased.
Now out of stock.
Ex : If the input is 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
