Question
Write a program for a movie rental business. Your program will determine the total amount a customer owes, less any discounts. It will consist of
Write a program for a movie rental business. Your program will determine the total amount a customer owes, less any discounts. It will consist of several functions. You must ONLY use the functions specified in the manner in which they are to work. Your main() function will ask the user their name and whether or not they are a repeat customer. If they are a repeat customer then you will call a function called getHistorylnformation that will ask for the tota number of movie rentals and the number of referrals to date for each quarter last year. This informat needs to be stored in an array in main). Your main) function will then call the getCurrentRentals() function which will get the total number of rentals that the customer is currently renting. Your main() function will then call a getDiscounts 0 function that will get the total discounts for the customer. The displayTotals() function will then calculate the current rental total, the total discount amounts (rental and referral), and the total amount due will then display the four values The main() function will then ask if there is another customer and if so repeat the process The getHistoryinformation() will ask for the total number of movies the customer rented for each quarter of the previous year and will ask for the number of referrals the customer had for each quarter last year (see sample output.) Be sure to validate the data so that a negative number cannot be entered. If there a negative value, produce and error message and allow them to input the number again. Remember these valid values are stored in an array in main() The getCurrentRentals) function will ask for the total number of movies that the customer is renting for the day. The customer cannot rent more than 5 movies at a time. If they do the will receive a message stating that fact. Your function should also validate the data so that a negative number of rentals are not allowed. There should also be an error message for this. Allow the user to continue to answer this question until valid and return a valid answer (See sample output.) The getDiscounts() function will determine and return the discount based on the number of movie rentals not including what they are renting today. If the customer has rented at least one movie, then their discount is 10%, if the customer has rented more than 10 movies, then their discount is 15%, if the customer has rented more than 25 movies, then their discount is 25%. The do not get a discount if they have never rented any movies in the past. The getDiscounts() function will also determine additional discount based on the number of referrals to date. You must use a switch statement to determine the discount. There is a 5% discount for 1 referral, 10% for 2 referrals, 15% for 3 referrals, 20% for 4 referrals and 25% for any referrals over 4. referral discount is also to be returned to main() They do not receive a discount for no referrals. The The displayTotals!) function wil must use a defined constant. Please note that the discounts are calculated separately and ll calculate and print the totals. The regular cost of each movie is $3.00 and are percentages of the subtotal. The following should be displayed by your function. \"Your current rental total is xx.x and \"Yo ur current rental discount is Sxx.xx\", and \"Your current referral discount is Sxx.x\", and \"Your current total due is Soxx. The amounts will then be followed by \"Enjoy your movie! \" (Please see output.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started