Question: can someone please tell me what's wrong with my code, and how to fix it. Thank you ! Java only Integers numBananas and dollars are



Integers numBananas and dollars are read from input. A banana costs 2 dollars. - If numBananas is less than 4 , output "numBananas is less than the required amount to purchase." - If numBananas is greater than or equal to 4 , then declare and initialize int variable totalst with the product of numBananas and 2 . - If totalCost is less than or equal to dollars, output "Successful purchasel" - Otherwise, output "Not enough money to buy all:" - If dollars is greater than or equal to 2 , output "At least one item was purchased" - If numBananas is greater than 21, output "Restocking soon. " Otherwise, output "Item still in stock:" End with a newline Ex. If the input is 1580 , then the output is: Successful purchase! At least one item was purchased. Item still in stock. Successful purchase! At least one item was purchased. Item still in stock. Ex: If the input is 1580 , then the output is: Successful purchase! At least one item was purchased. Item still in stock. - If numBananas is greater than 21, output "Restocking soon." Otherwise, output "Item End with a newline. Ex: If the input is 1580 , 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
