Problem Statement: Movie Rental Store
You are required to write a program for Movie Rental Store. The basic idea is that user/reader will provide customer information, movie name, and number of days. Upon this information your program will calculate the charged amount for that movie.
Detailed Description:
- The program should display
Please provide customer Name:
Please provide Movie Description.
Enter ‘R’ for Regular Movie.
Enter ‘C’ for children Movie.
Enter ‘N’ for New Released Movie.
Enter ‘E’ for English Movie.
Then your program should take these inputs,
Depending upon the choices that user has entered, your program will further display the prompt
If user has entered Movie description, then your program should prompt the user to enter the Movie Name and Number of days.
-----------------------------------------------------------------
Movie Name :Number of day’s:After getting all this information, now write a function which will calculate rental/charged amount on the basis of this information.
To calculate rental/charged amount we will use this formula:
Rental amount = charged amount * number of days
Charged amount will be different for different movies according to following description:
Regular Movie: 40 RS
Children Movie: 30 RS
English Movie: 50 RS
New release: 100 RS
After calculating charged amount for this movie and display it on the screen.
Sample Output
Please provide customer Name: Aftab
Please provide Movie Description:
Enter ‘R’ for Regular Movie:
Enter ‘C’ for children Movie:
Enter ‘N’ for New Released Movie:
Enter ‘E’ for English Movie:
R
Please provide following information:
Movie Name : Jinnah
Number of day’s: 3
Final output:
-----------------------------------------------------------------
Customer Name: Aftab
Movie Type : Regular
Movie Name : Jinah
Number of day’s: 3
Your Rental Amount is: 120 Rs
-----------------------------------------------------------------
Solution:
#include <iostream.h>
int main()
{
int daysNumber, rentalAmount; // variables to store number of days and rental amount
char customerName, movieName, movieType ; //variables to store customer's name, movie name and movie type (R,C,N,E)
//prompt user to provide customer name
cout << "Please provide customer name:" ;
cin >> customerName ;
//prompt user to provide movie description
cout << "Please provide movie description:" "n" ;
cout << "Enter 'R'for Regular Movie" "n" ;
cout << "Enter 'C'for Children Movie" "n" ;
cout << "Enter 'N'for New Released Movie" "n" ;
cout << "Enter 'E'for English Movie" "n" ;
cin >> movieType ;
//prompt user to enter movie name
cout << "Movie Name :" ;
cin >> movieName ;
//propmt user to enter number of days
cout << "Number of days :" ;
cin >> daysNumber ;