Q BgQuestion:

      
Rookie
Karma Points: 0
Respect (88%):
posted by  e2ahmed on 11/3/2009 7:29:14 PM  |  status: Closed  |  Earned Karma: 0

Problem Statement: Movie Rental Store(C++)

Course Textbook Chapter Problem Needs by
Computer Architecture C++: How to Program (7th) by Deitel, Deitel N/A N/A 11/4/2009 at 6:00:00 PM
Question Details:
 

Assignment

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:

 1. 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,

 2. Depending upon the choices that user has entered, your program will further display the prompt

 3. If user has entered Movie description, then your program should prompt the user to enter the Movie Name and Number of days.

 i-----------------------------------------------------------------

          Movie Name :            

          Number of day’s:

       --------------------------------------------------------------- 4. 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

e2bari

AAnswers:

Answer Question Ask for clarification
Oracle
Karma Points: 31,937
posted by rapunzel on 11/3/2009 7:56:03 PM  |  status: Live
Asker's Rating: Lifesaver   
Response Details:
please rate - thanks

#include <iostream>
using namespace std;
int rentalamount(int,int);
int main()
{char choice;
string name,movie,type;
int days,rate;
cout<<"Please provide customer Name: ";
cin>>name;
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>>choice;
cout<<"Please provide following information:\n";
cout<<"  Movie name: ";
cin>>movie;
cin.ignore(80,'\n');
cout<<"  Enter number of day's: ";
cin>>days;

switch(choice)
 {case 'R':  rate=40;
             type="Regular";
             break;
  case 'C':  rate=30;
             type="Childrens";
             break;       
  case 'N':  rate=100;
             type="New Release";
             break;  
  case 'E':  rate=50;
             type="English";
             break;       
  default:  cout<<"Invalid entry-program will exit\n";
            system("pause");
             return 0;
}

cout<<"----------------------------------------\n";
cout<<"Customer Name: "<<name<<endl;
cout<<"Movie Type : "<<type<<endl;     
cout<<"Movie Name : "<<movie<<endl;  
cout<<"Number of day\'s:  "<<days<<endl;
cout<<"Your Rental Amount is: "<<rentalamount(rate,days)<<" Rs"<<endl;
cout<<"----------------------------------------\n";
system("pause");
return 0;
}
int rentalamount(int r,int d)
{return r*d;
}    

Note to all members 1. Please 1 question per post 2. Show respect to your fellow members by rating all answers. 3. When rating remember that the first answer is not necessarily the best answer. 4. When answering questions, explain what you are doing, so that the asker will learn, don't just give a meaningless number. 5. Your answers should be your work. Don't copy from another member, this is Karma abuse and possible disciplinary actions against you. and GOOD LUCK to you all!!
Answer Question Ask for clarificarion

Join Cramster's Community

Cramster.com brings together students, educators and subject enthusiasts in an online study community. With around-the-clock expert help and a community of over 100,000 knowledgeable members, you can find the help you need, whenever you need it. Join for free today » How Cramster is different from tutoring »