Question: Integer variables numSoups and cash are read from input. A soup costs 4 dollars. If numSoups is greater than or equal to 5, then multiply
Integer variables numSoups and cash are read from input. A soup costs 4 dollars. If numSoups is greater than or equal to 5, then multiply numSoups by 4. If the product of numSoups and 4 is less than or equal to cash, output "Successful purchase!". Otherwise, output "Not enough money to buy all.". If cash is greater than or equal to 4, output "At least one item was purchased." If numSoups is greater than 25, output "Restocking soon.". Otherwise, output "Item still in stock.". End with a newline. Ex: If the input is 13 63, then the output is: Successful purchase! At least one item was purchased. Item still in stock.
Integer variables numSoups and cash are read from input. A soup costs 4 dollars. - If numSoups is greater than or equal to 5 , then multiply numSoups by 4. - If the product of numSoups and 4 is less than or equal to cash, output "Successful purchase!". - Otherwise, output "Not enough money to buy all.". - If cash is greater than or equal to 4, output "At least one item was purchased." - If numSoups is greater than 25, output "Restocking soon.". Otherwise, output "Item still in stock.". End with a newline. Ex: If the input is 13 63, then the output is: Successful purchase! At least one item was purchased. Item still in stock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
