Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The On the Go family super market is giving discounts for their customers who shop between 16:00 to 22:00 hrs. The discounts are given according

image text in transcribed

The "On the Go" family super market is giving discounts for their customers who shop between 16:00 to 22:00 hrs. The discounts are given according to the time and the amount they spend at the shop. The discount percentages are shown in the following table. a) Write a function called calDiscount ( ) to calculate the discount given for a transaction by sending the time as and integer ( eg : between 16:00 to 16:59 enter only 16 ) and the total amount as parameters. float caldiscount (int time, float totAmount) b) Write a function called testCaldiscount ( ) which contains two assert statements debug the above implemented function. The supermarket has also decided to give a free gift for the customers according to the amount after deducting the discount. The table below shows the criteria for the gifts. c) Write a function called displaygift ( ) to display the gifts obtained by each customer. void displayGift(float finalTot) d) In your main program do the following : i. Call the testcaldiscount( ) function. ii. Input the time and the total amount from keyboard. If the user enters an invalid time then display an error message. Display the final amount(after discount) and the gift obtained using the two functions implemented in part a) and part c)

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

2. Are there more men or women? (find statistics)

Answered: 1 week ago

Question

understand how design and writing connect in mass communication.

Answered: 1 week ago

Question

Who is the audience?

Answered: 1 week ago