CSCI 151 Fall 2014 Lab 12 Assignment

In this assignment YOU MUST USE LOOP FOR

Some store has a ONE-DAY sale with the following rules: if the customer purchasing the items before 2 pm there are two possible disounts: 20 dollars off, if the customer is purchasing for $50 or more or 20% off the entire purchase. If the customer arrives after 2 pm there is only 20% discount.

Write a function final_price that has 2 parameters: number of items the customer is purchasing and arrival time(integer, assume that time is entered in 24 hr fomat). The function is reading the original price for each item and using the discount rules described above to find and return the final price of the purchase. The function must use the best possible disount available to allow customer to pay the minial price possible. For example, if the customer purchasing time was 10, and the total before discount was 120 dollars, it is better to use 20% discount and not $20 off discount.

Write a function store_sales that has one parameter - number of customers who visited the store on the ONE-DAY sale. The function reads the number of items each customer bought and the purchase time. The function finds and returns the total amount of money all customers spend in the store on the ONE-DAY sale and the average purchasing price for that day. The function uses function final_price to calculate the final price for each customer.

Write main that reads the number of customers who visited the store and finds the total amount of money all customers spend in the store on the ONE-DAY sale and the average purchasing price for that day.

Write a few examples of the input/output that you use to test your program