Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

b. Will new members be welcomed?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago