Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

List various functions and activities of HRM.

Answered: 1 week ago