Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started