In: Computer Science
You have been instructed to use C++ to develop, test, document, and submit a simple program with the following specifications. The program maintains a short data base of DVDs for rent with their name, daily rental charge, genre, and a a short description . The program will welcomes the user, user will enter the name of the movie from a displayed list of all movies that are available, the user will enter the number next to the movie's name, number of days to rent. The program will display all the information in the data base, number of rental days, and total charges. No tax is charged. The maximum number of days a movie can be rented is 7.
#include<iostream>
using namespace std;
int main(){
string
dvd[]={"Zorawar","King","Dangal","Pagalpanti","Race"};
int price[]={40,20,50,30,10};
string
genre[]={"Comedy","horor","drama","comedy","romantic"};
string desc[]={"This is comedy movie","This is horor
movie","This is drama movie","This is comedy movie","This is
romantic movie"};
for(int i=0;i<5;i++)
cout<<i+1<<"
"<<dvd[i]<<endl;
cout<<"Choose the dvd"<<endl;
int c, n;
cin>>c;
while(c>5){
cout<<"Invalid
option"<<endl;
cout<<"Choose the
dvd"<<endl;
cin>>c;
}
cout<<"Enter no. of rent
days"<<endl;
cin>>n;
while(n>7){
cout<<"Maximum days rent is
7"<<endl;
cout<<"Enter no. of rent
days"<<endl;
cin>>n;
}
cout<<"DVD\tPrice\tGenre\tDescription\tRent_Days\tTotal_Price"<<endl;
cout<<dvd[c-1]<<"\t"<<price[c-1]<<"\t"<<genre[c-1]<<"\t"<<desc[c-1]<<"\t"<<n<<"\t"<<(n*price[c-1])<<endl;
return 0;
}