Can someone give me the complete code of the following problem:

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.

-----------------------------------------------------------------
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 $
Children Movie: 30 $
English Movie: 50 $
New release: 100 $


After calculating charged amount for this movie and display it on the screen.


Sample Output

Please provide customer Name: John

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 : Troy
Number of day’s: 3


Final output:

-----------------------------------------------------------------
Customer Name: John
Movie Type : Regular
Movie Name : Troy
Number of day’s: 3
Your Rental Amount is: 120 $
-----------------------------------------------------------------

tux4life commented: Learn to do your own homework! -1
pspwxp fan commented: Don't think others will always spoonfeed you +0
William Hemsworth commented: lazy cheater. -1
#include <iostream.h>
#include <windows.h>

char customer_name[255];
char description;

void output(char customer_name, char movie_name, char nights, char output);
int main()
{
   char movie_name[255];
   const int regular = 40;
   const int children = 30;
   const int english = 50;
   const int new = 100;
   int nights;
   int total;
   cout << "Please enter the customer name: ";
   cin >> customer_name;
   cout << "\n Type of Movie: ";
   cout << "Enter ‘R’ for Regular Movie Enter ‘C’ for children Movie Enter ‘N’ foNew Released Movie.Enter ‘E’ forEnglish Movie. ";
   cin >> description; 
   switch(description)
   {
 
      case 'r': case 'R': system("cls");
                               cout << "Please enter the movie name: ";
                               cin >> movie_name;
                               cout << "\nPlease enter the number of nights: ";
                               cin >> nights;
                               total = regular*nights;
                               output(customer_name, movie_name, nights, total);
       break;
    
       // few more cases
       // few more cases

      default: cout << "Your option was unknown";
      break;
   }

  return EXIT_SUCSESS;
}

void output(char customer_name, char movie_name, int nights, int total)
{

   cout << "Customer Name: " << customer_name << endl;
   cout << "Movie Title: " << movie_name << endl;
   cout << "Nights: " << nights << endl;
   cout << "Total: " << output << endl;
}

Should be OK. I haven't compiled it or anything, it's a start.. Some work for you to do though!!

commented: We don't give free code here. -1

this is not the way to be a programmer. dont copy paste somebody else code if u dont know what is going on inside it.
do u know what windows.h do? Bad learning approach

this is not the way to be a programmer. dont copy paste somebody else code if u dont know what is going on inside it.
do u know what windows.h do? Bad learning approach

Sorry, is that aimed at me or...?

Sorry, is that aimed at me or...?

No, probably aimed at Zemly because of you.

@Zem: Daniweb isn't here to spoonfeed you. Its here to help you. You start with your code and scratch up anything you can. Then post your problem. You were lucky this time that Phil++ decided to make a program for you.
If you don't know C++ and have forced yourself to take it, it was a mistake.

My bad :( Ahh, I bet it isn't even right anyway, I haven't even tried to compile it. xD

My bad :( Ahh, I bet it isn't even right anyway, I haven't even tried to compile it. xD

Never give code to anyone who doesn't show effort, you're just helping him cheat.

mmm, I'm getting bad rep now :S

mmm, I'm getting bad rep now

You can expect it :P
It's a good thing you want to help, but to really help the OP you have to make him learn something, giving him the answer is ultimately making him dumber when he gets his next piece of homework.

commented: Agreed :) +6

Yeah, I know what you mean. I didn't do the whole code and there will probs be some errors in it anyway. But when I don't give the full code, give advice, I get P/M asking me for the project / Asking me to add them to messenger.

Lesson Learnt: Don't give the whole project!

commented: Here's some green for learning the lesson! :) +8

Thank you very much. But if you please send me the whole code i'll be very thanks full to you.

Thank you very much. But if you please send me the whole code i'll be very thanks full to you.

Now you're just messing with people's heads, aren't you? You were just told flat out that that was against the rules, the guy who gave you the code and the guy you PM'd got lectured for even giving you the amount of code that he gave you already, and he's said he's not going to give you the entire project, and hopefully no one will. If you want help, show some effort.

I will not give you the whole project, it seems there isn't much to do just to add a few more cases in your switch statement. What I don't understand is, if this is for an assignment - surely they must have taught you the content and not just said "Go ask for the source code off a forum - I cba teaching today" You must be able to do at least some to make an effort. To me, you either haven't been paying attention in class, you're lazy or you're not cut out to be a programmer. If you decide to take programming up as a job in the future, you'd just fail (no offence) because this kind of program is a walk in the park compared to commercial projects that you will need to undertake and daniweb isn't always going to give you the answers you're looking for. It's basic logic, look at the project -> look at the code. It might help you if you produce like flow charts, Pseudocode to help you. Good look.

commented: How you have the right idea :) +24

I am doing my best and writting the program. But still have a problem. When i write a code for input and execute it, it asks for input sometimes and sometims not. Now plz tell me how can i solve this problem. Thanks

Now plz tell me how can i solve this problem. Thanks

Start by showing us some effort, what have you done so far?
We help step by step with specific problems, don't expect anybody to give you large chunks of code that just work.

let me show you what i have done

If you post what you have done so far, whatever code it is, we'll try and help you. :)

#include <iostream.h>

main()
{
char name;
char description;
char movie;
int regular = 40;
int children = 30;
int english = 50;
int newer = 100;
int days;
int total;
cout<< "Please enter the name of customer: ";
cin>> name;
cout<< "\nMovie description: ";
cout<< "\n";
cout<< "\n Enter R for regular movie";
cout<< "\n Enter C for children movie";
cout<< "\n Enter N for new released movie";
cout<< "\n Enter E for english movie";
cout<< "\n";
cout<< "\nPlease enter movie description: ";
cin>> description;
cout<<"\n";
cout<< "\nPlease provide following information: ";
cout<< "\nMovie Name: ";
cin>> movie;
cout<< "\nPlease enter the number of days: ";
cin>> days;
}


\\ I have written this code and compling it. It doesnt shows any error. but when it execute it doesnt work properly. Plz execute it your self and tell me about it. Plz

commented: STILL will not use code tags. -2
#include <iostream.h>
int main()
{
char name;
char description;
char movie;
const int regular = 40;
const int children = 30;
const int english = 50;
const int newer = 100;
int days;
int total;

cout<< "Please enter the name of customer: ";
cin>> name;
cout<< "\nMovie description: ";
cout<< "\n";
cout<< "\n Enter R for regular movie";
cout<< "\n Enter C for children movie";
cout<< "\n Enter N for new released movie";
cout<< "\n Enter E for english movie";
cout<< "\n";
cout<< "\nPlease enter movie description: ";
cin>> description;
cout<<"\n";
cout<< "\nPlease provide following information: ";
cout<< "\nMovie Name: ";
cin>> movie;
cout<< "\nPlease enter the number of days: ";
cin>> days;

system("PAUSE");
return EXIT_SUCSESS;
}

try that :)

I should have seen that coming a mile away, use code-tags from now on, or i wont bother replying.
I'm pretty sure your name has more that one letter, doesn't it?

[B]char name[100][/B];
char description;
char movie;
int regular = 40;
int children = 30;
int english = 50;
int newer = 100;
int days;
int total;

Same applies for movie and description, they need to be character arrays.

Silly me :P

Plz reply fast i am witing brother

Plz reply fast i am witing brother

Two things, firstly this may be urgent to you, but it's not for us. Secondly, I've already answered your question! Have you tried doing what I said?

It isnt working. Plz do help me. It am going mad thinking about it. Plz do something

It isnt working. Plz do help me. It am going mad thinking about it. Plz do something

How isn't it working? we aren't psychic, you have to tell us what's going on at your end.
What errors do you get, and show me the code you tried compiling.

Thanks. everything is working now but cin>>days; is not getting input. Plz tell me how i solve this problem

main() {
       char r,R,E,e,c,C,n,N,choice;
       string name,movie,movietype;
       double rent,days,re=40,ch=30,nr=100,eng=40;
       cout<<"Enter Name:";
       cin>>name;
       cout<<"[R]Regular Movie\n";
       cout<<"[C]Children Movie\n";
       cout<<"[E]English Movie\n";
       cout<<"[N]New Released Movie\n";
       cout<<"Choose One:";
       cin>>choice;
       cout<<"Enter Movie Name:";
       cin>>movie;
       cout<<"Number of Days:";
       cin>>days;
       
       if((choice=='R')||(choice=='r')){
                      rent=re*days;
                      movietype="Regular";
                      }
       else if((choice=='C')||(choice=='c')){
                      rent=ch*days;
                      movietype="Children Movie";
                      }         
        else if((choice=='N')||(choice=='n')){
                      rent=nr*days;
                      movietype="New Release";
                      }     
    else if((choice=='E')||(choice=='e')){
                      rent=eng*days;
                      movietype="English Movie";
                      }

        system("cls");
        
        cout<<"Customer's Name:"<<name<<endl;
        cout<<"Movie Type:"<<movietype<<endl;
        cout<<"Movie Name:"<<movie<<endl;
        cout<<"Number of Days:"<<days<<endl;
        cout<<"Your Rental Amount is:"<<rent<<endl;
        
        getch();
        return 0;
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.