Question: num _ coconuts and my _ money are read from input. A coconut costs 3 dollars.If num _ coconuts is less than 5 , then

num_coconuts and my_money are read from input. A coconut costs 3 dollars.If num_coconuts is less than 5, then output 'Please purchase at least 5.'If num_coconuts is greater than or equal to 5, then assign total_cost with the product of num_coconuts and 3.If total_cost is less than or equal to my_money, then output 'Successful purchase!'Otherwise, output 'Not enough money to buy all.'If my_money is greater than or equal to 3, then output 'At least one item was purchased.'If num_coconuts is greater than 29, then output 'Now out of stock.'Otherwise, output 'Item still in stock.'Click here for examplesEx 1: If the input is:120then the output is:Please purchase at least 5.Item still in stock.Ex 2: If the input is:113435then the output is:Successful purchase!At least one item was purchased.Now out of stock.Ex 3: If the input is:58102then the output is:Not enough money to buy all.At least one item was purchased.Now out of stock.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!