Answered step by step
Verified Expert Solution
Link Copied!

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 num_cakes and money_in_bank are read from input. Each cake costs 3 dollars.
Write the following if-else statement. Within the if branch, write the following assignment and nested if-else statement:
If num_cakes is greater than or equal to 4:
Assign variable total_cost with the product of num_cakes and 3.
If total_cost is less than or equal to money_in_bank, then output 'Approved transaction'.
Otherwise, output 'Not enough money to buy all'.
Otherwise, output 'Not allowed to purchase less than 4 cakes'

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_2

Step: 3

blur-text-image_3

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions