944,161 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2865
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Oct 17th, 2009
-4

Please Help Me.

Expand Post »
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 $
-----------------------------------------------------------------
Reputation Points: 2
Solved Threads: 0
Newbie Poster
zemly is offline Offline
18 posts
since Oct 2009
Oct 17th, 2009
-2
Re: Please Help Me.
Reputation Points: 9
Solved Threads: 0
Newbie Poster
warbird43 is offline Offline
22 posts
since Aug 2009
Oct 17th, 2009
-4
Re: Please Help Me.
C++ Syntax (Toggle Plain Text)
  1. #include <iostream.h>
  2. #include <windows.h>
  3.  
  4. char customer_name[255];
  5. char description;
  6.  
  7. void output(char customer_name, char movie_name, char nights, char output);
  8. int main()
  9. {
  10. char movie_name[255];
  11. const int regular = 40;
  12. const int children = 30;
  13. const int english = 50;
  14. const int new = 100;
  15. int nights;
  16. int total;
  17. cout << "Please enter the customer name: ";
  18. cin >> customer_name;
  19. cout << "\n Type of Movie: ";
  20. cout << "Enter ‘R’ for Regular Movie Enter ‘C’ for children Movie Enter ‘N’ foNew Released Movie.Enter ‘E’ forEnglish Movie. ";
  21. cin >> description;
  22. switch(description)
  23. {
  24.  
  25. case 'r': case 'R': system("cls");
  26. cout << "Please enter the movie name: ";
  27. cin >> movie_name;
  28. cout << "\nPlease enter the number of nights: ";
  29. cin >> nights;
  30. total = regular*nights;
  31. output(customer_name, movie_name, nights, total);
  32. break;
  33.  
  34. // few more cases
  35. // few more cases
  36.  
  37. default: cout << "Your option was unknown";
  38. break;
  39. }
  40.  
  41. return EXIT_SUCSESS;
  42. }
  43.  
  44. void output(char customer_name, char movie_name, int nights, int total)
  45. {
  46.  
  47. cout << "Customer Name: " << customer_name << endl;
  48. cout << "Movie Title: " << movie_name << endl;
  49. cout << "Nights: " << nights << endl;
  50. cout << "Total: " << output << endl;
  51. }

Should be OK. I haven't compiled it or anything, it's a start.. Some work for you to do though!!
Reputation Points: 41
Solved Threads: 7
Posting Whiz in Training
Phil++ is offline Offline
233 posts
since Jan 2009
Oct 17th, 2009
0
Re: Please Help Me.
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
Reputation Points: 9
Solved Threads: 0
Newbie Poster
warbird43 is offline Offline
22 posts
since Aug 2009
Oct 17th, 2009
0
Re: Please Help Me.
Click to Expand / Collapse  Quote originally posted by warbird43 ...
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...?
Reputation Points: 41
Solved Threads: 7
Posting Whiz in Training
Phil++ is offline Offline
233 posts
since Jan 2009
Oct 17th, 2009
0
Re: Please Help Me.
Click to Expand / Collapse  Quote originally posted by Phil++ ...
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.
Last edited by pspwxp fan; Oct 17th, 2009 at 2:17 pm.
Reputation Points: 43
Solved Threads: 7
Junior Poster in Training
pspwxp fan is offline Offline
93 posts
since Feb 2009
Oct 17th, 2009
0
Re: Please Help Me.
My bad Ahh, I bet it isn't even right anyway, I haven't even tried to compile it. xD
Reputation Points: 41
Solved Threads: 7
Posting Whiz in Training
Phil++ is offline Offline
233 posts
since Jan 2009
Oct 17th, 2009
0
Re: Please Help Me.
Click to Expand / Collapse  Quote originally posted by Phil++ ...
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.
Last edited by William Hemsworth; Oct 17th, 2009 at 2:29 pm.
Reputation Points: 1429
Solved Threads: 129
Posting Virtuoso
William Hemsworth is offline Offline
1,542 posts
since Mar 2008
Oct 17th, 2009
0
Re: Please Help Me.
mmm, I'm getting bad rep now
Reputation Points: 41
Solved Threads: 7
Posting Whiz in Training
Phil++ is offline Offline
233 posts
since Jan 2009
Oct 17th, 2009
1
Re: Please Help Me.
Quote ...
mmm, I'm getting bad rep now
You can expect it
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.
Reputation Points: 1429
Solved Threads: 129
Posting Virtuoso
William Hemsworth is offline Offline
1,542 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: gnu c++ int class
Next Thread in C++ Forum Timeline: getline function





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC