Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Integers numMangos and cash are read from input. A mango costs 2 dollars. - If numMangos is greater than or equal to 2 , then
Integers numMangos and cash are read from input. A mango costs 2 dollars. - If numMangos is greater than or equal to 2 , then declare and initialize int variable totalCost with the product of numMangos and 2. - If totalCost is less than or equal to cash, output "Mangos successfully purchased." - Otherwise, output "Not all mangos purchased." - If numMangos is greater than 21, output "Restocking soon." Otherwise, output "Item still in stock." End with a newline. Ex: If the input is 1657 , then the output is: Mangos successfully purchased. Item still in 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