Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Integers num _ cakes and money _ in _ bank are read from input. Each cake costs 3 dollars. Write the following if - else
Integers numcakes and moneyinbank are read from input. Each cake costs dollars.
Write the following ifelse statement. Within the if branch, write the following assignment and nested ifelse statement:
If numcakes is greater than or equal to :
Assign variable totalcost with the product of numcakes and
If totalcost is less than or equal to moneyinbank, then output 'Approved transaction'.
Otherwise, output 'Not enough money to buy all'.
Otherwise, output 'Not allowed to purchase less than cakes'
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