954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please Help Me.

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 $
-----------------------------------------------------------------

zemly
Newbie Poster
18 posts since Oct 2009
Reputation Points: 2
Solved Threads: 0
 
warbird43
Newbie Poster
23 posts since Aug 2009
Reputation Points: 9
Solved Threads: 0
 
#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!!

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 

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

warbird43
Newbie Poster
23 posts since Aug 2009
Reputation Points: 9
Solved Threads: 0
 
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...?

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 
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.

pspwxp fan
Junior Poster
100 posts since Feb 2009
Reputation Points: 43
Solved Threads: 7
 

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

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 
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.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

mmm, I'm getting bad rep now :S

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 
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 himlearn something, giving him the answer is ultimately making him dumber when he gets his next piece of homework.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

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!

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 

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

zemly
Newbie Poster
18 posts since Oct 2009
Reputation Points: 2
Solved Threads: 0
 
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.

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

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.

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 

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

zemly
Newbie Poster
18 posts since Oct 2009
Reputation Points: 2
Solved Threads: 0
 
Now plz tell me how can i solve this problem. Thanks

Start by showing us some effort, what haveyou 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.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

let me show you what i have done

zemly
Newbie Poster
18 posts since Oct 2009
Reputation Points: 2
Solved Threads: 0
 

Okie Doke.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

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

Phil++
Posting Whiz in Training
233 posts since Jan 2009
Reputation Points: 41
Solved Threads: 7
 

#include

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

zemly
Newbie Poster
18 posts since Oct 2009
Reputation Points: 2
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You