473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

The movie rental program

i've be given this task to do. as a member i want to learn this program while i'm doing it with you.i'm hoping i'll be with you through the next two hours.
this is the program below.


Program 2
MULTICHOICE VIDEO RENTAL SHOP needs an Object Oriented program that process the following information about ten (10) videos in their stock
• The title, the director, the year produced and a list of main actors for each video. (If there are more than five main actors, include only the five most famous actors)
• The function setVideo that input information into each video object
• The function getVideo that displays information of a particular video on the screen
• A customer (identified by ID) plus his full names and address can borrow at most 2 videos @ R12.50 per day. A penalty of 10% per day is charged if returned late. The borrow period is at most 7 days
• Video titles should not exceed 25 characters in length. If that happens, truncate the length to a most 25 characters
• A video should be checked if is not rented out before borrow transaction is processed. If borrowed out the customer should either be requested for the second choice or be advised when the video is expected back in the shop
• Failure for the shop to receive the video back within 7 days, is considered permanent loss and the customer is liable to a R400.00 compensation fee
• Information about the number of films in stock at any point in time should be readily available
• At the end of business, a report should be generated showing
o Which films are rented out and when are they due
o To which customers they are borrowed to
o Which videos are left in stock
o How much money was collected for the day
Generate your own test data that will test all cases to illustrate the accuracy and consistency of your program


so i'm not sure whether to use two classes,or to use struct customer and a movie class.
Oct 25 '07 #1
10 12117
this is the first part of my program including two classes one for the video and the other for customers

Expand|Select|Wrap|Line Numbers
  1. code[c++]

#include<iostream>
#include<iomanip>
#include<string>

class Video{

private:
string Title;
string Director;
int Year;
string Actors;

public:
Video(string title,string director,int year,string actors)
{
SetVideo(title,director,year,actors);

}
void SetVideo(string title,string director,int year,string actors)
{
Title=title;

Title=(title>=0 && title<25) ? title:25;

Director=director;

Year=year;
Year=(year<=0 && year<2007) ? year:1900;
Actors=actors;

}
void GetVideo()
{
cout<<Title<<"\n"
<<Director<<"\n"
<<Year<<"\n"
<<Actors<<"\n\n";

}

};
class Customer{
private:
string Id;
string Name;
string Address;

public:
Customer(string id,string name,string address)
{
SetInfo(id,name,address);
}
void SetInfo(string id,string name,string address)
{
Id=id;
Name=name;
Address=address;

}
void GetInfo()
{
cout<<Id<<"\n"
<<Name<<"\n"
<<Address<<"\n\n";
}
Oct 25 '07 #2
please guys i'm frustrated

Expand|Select|Wrap|Line Numbers
  1. l#include<iostream>
  2. #include<iomanip>
  3. #include<string>
  4. using namespace std;
  5.  
  6. struct Video
  7. {
  8.  
  9.     string title;
  10.     string director;
  11.     int year;
  12.     string actors;
  13. };
  14.  
  15.  
  16. struct Customer
  17. {
  18.    string id;
  19.     string name;
  20.     string address;
  21. };
  22.  
  23.  void GetInfo(Customer[]);
  24.  void GetVideo(Video[],int);
  25.  //void SetVideo(Video[],int;
  26.  
  27.  int main()
  28.  {
  29.    int loop;
  30.  
  31.    Video myInfo[7];Customer info[3];
  32.    GetInfo(info);
  33.    cout<<"how many movies you are adding?:";
  34.    cin>>loop;
  35.    cin.get();
  36.    Video total[10];
  37.       for(int x=0;x<loop;x++)
  38.    {
  39.     GetVideo(myInfo,loop);
  40.    }
  41.  //SetVideo(myInfo,loop);
  42.  
  43.  return 0;
  44.  
  45.  
  46.  }
  47.  void GetVideo(Video movie[],int loop)
  48.  {
  49.   int number;
  50.  
  51.   for(int x=0;x<loop;x++)
  52.   {
  53.  
  54.           cout<<"Movie Info:\n\n";
  55.           cout<<"Title:";
  56.           getline(cin,movie[x].title);
  57.           cin.get();
  58.           cout<<"Director:";
  59.           getline(cin,movie[x].director);
  60.           cout<<"Year Produced:";
  61.           cin>>movie[x].year;
  62.           cin.get();
  63.           cout<<"How many Actors?";
  64.           cin>>number;
  65.  
  66.           for(int y=0;y<number;y++)
  67.           { 
  68.               cout<<"Actor:";
  69.               getline(cin,movie[y].actors);
  70.               cout<<"\n\n";
  71.           }
  72.           cout<<"\n\n";
  73.   }
  74.  
  75.  
  76. }
  77. void GetInfo(Customer info[])
  78. {
  79.     for(int x=0;x<1;x++)
  80.     {
  81.       cout<<"Client Info:\n\n";
  82.       cout<<"Id:";
  83.       getline(cin,info[x].id);
  84.       cin.get();
  85.       while(info[x].id!= "13" )
  86.       {   
  87.           cout<<"wrong ID number\n";
  88.           cout<<"enter a (13-digit)number please:";
  89.           getline(cin,info[x].id);
  90.       }
  91.       cin.get();
  92.       cout<<"Name:";
  93.       getline(cin,info[x].name);
  94.       cout<<"Address:";
  95.       cin.get();
  96.       getline(cin,info[x].address);
  97.       cout<<"\n\n";
  98.     }
  99.  
  100.  
  101.  
  102. }
Oct 25 '07 #3
sicarie
4,677 Expert Mod 4TB
please guys i'm frustrated
Where are you frustrated? What are you trying to do that's not working? How is it not working? Come on, Nkhosinathie, you've been here long enough to know how this is supposed to work, you have to help us!

PS - Next time you respond/create a thread, please read the box on the right side of the page very carefully - they will show you how to use code tags properly.
Oct 25 '07 #4
Where are you frustrated? What are you trying to do that's not working? How is it not working? Come on, Nkhosinathie, you've been here long enough to know how this is supposed to work, you have to help us!

PS - Next time you respond/create a thread, please read the box on the right side of the page very carefully - they will show you how to use code tags properly.
thank you Sicarie,my problem firstly is to assign those ten movies inside one array so that when i need those movies i can get them there.
Oct 25 '07 #5
sicarie
4,677 Expert Mod 4TB
Okay, in your main you create a list of videos with

Expand|Select|Wrap|Line Numbers
  1. Video myList[7];
  2.  
and then do another with

Expand|Select|Wrap|Line Numbers
  1. Video total[10];
  2.  
Why both? And you have the right general idea - but can I ask you to look at this:

Expand|Select|Wrap|Line Numbers
  1. for(int x=0;x<loop;x++)
  2.    {
  3.     GetVideo(myInfo,loop);
  4.  
  5. /*
  6. ...
  7. */
  8.  
  9.  void GetVideo(Video movie[],int loop)
  10.  {
  11.   int number;
  12.  
  13.   for(int x=0;x<loop;x++)
  14.   {
  15.  
Why do you have two loops there? You only need one. You can choose to keep everything local and call GetVideo separately from main() to get each info set, or you can pass the number to GetVideo() and do it there, but you don't need to do it in both. Just one thing to think about, though, what if you only want to do it once? Do you really want to have to remember to pass 1 to GetVideo() every time you want to call it once?

There are still a few other things, but I would start there.
Oct 25 '07 #6
Okay, in your main you create a list of videos with

Expand|Select|Wrap|Line Numbers
  1. Video myList[7];
  2.  
and then do another with

Expand|Select|Wrap|Line Numbers
  1. Video total[10];
  2.  
Why both? And you have the right general idea - but can I ask you to look at this:

Expand|Select|Wrap|Line Numbers
  1. for(int x=0;x<loop;x++)
  2.    {
  3.     GetVideo(myInfo,loop);
  4.  
  5. /*
  6. ...
  7. */
  8.  
  9.  void GetVideo(Video movie[],int loop)
  10.  {
  11.   int number;
  12.  
  13.   for(int x=0;x<loop;x++)
  14.   {
  15.  
Why do you have two loops there? You only need one. You can choose to keep everything local and call GetVideo separately from main() to get each info set, or you can pass the number to GetVideo() and do it there, but you don't need to do it in both. Just one thing to think about, though, what if you only want to do it once? Do you really want to have to remember to pass 1 to GetVideo() every time you want to call it once?

There are still a few other things, but I would start there.
thank you sicarie,the past i was doing the general programming now we have changed to the object's programming so i'm really struggling.anyway i created two loops because i'm enterring the video information and at the same time i'm taking each movie inside video total. so how can i put all this ten movies into one array?
Oct 26 '07 #7
thank you sicarie,the past i was doing the general programming now we have changed to the object's programming so i'm really struggling.anyway i created two loops because i'm enterring the video information and at the same time i'm taking each movie inside video total. so how can i put all this ten movies into one array?
please i seriously need your help here
Oct 26 '07 #8
please i seriously need your help here
please,please i need some fresh ideas please
Oct 26 '07 #9
please,please i need some fresh ideas please
i'm next to a compiler now,so i did compile my sorce-code and there are no errors.so my question is how can i assign all the ten movies that i'm entering inside the getVideo function? anyone help please!
Oct 26 '07 #10
sicarie
4,677 Expert Mod 4TB
Nkhosinathie-

You are a member of this community, and we enjoy not only helping you, but your ideas and input in discussions raised. It's always good to have someone new to the material because they think of new things and new ways to look at it.

That being said, you have been here long enough and pointed to the Programming Guidelines enough times that you need to start strictly adhering to them. The Mods are going to have to start taking actions against you soon due to the disruption and the amount of work it takes to clean up after you.

The link to the Guidelines is above, but in this thread specifically, 1) be paitent. We volunteer our time, and we can't be on 100% of the time. You have the benefit of all the registered members as well as the mods, and someone will be around eventually. 2) code tags. I think we've spoken about this, 3) paying attention to what is written and playing with it yourself. If you look at the last part of what I posted, you will see I say that you can do that one of two places, but not both of the places you have it set. I would recommend doing it in your main() and removing it from GetVideo().

We would like you to stay around, so please start playing around with your code and learning the theory behind not only what we are saying, but also what your instructor is saying. They are "big-picture" trying to get you through OOP, and we're looking at the smaller picture helping with your individual assignment.

Have another look at GetVideo and where it is called (specifically the loop where it is called). You have two control structures set up to populate your array, and you need to choose one of those locations to do it.
Oct 26 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: jonathanztaub | last post by:
I have a DVD CD. * Is it possible to embed it within an html page? * Does the user has to have windows media player or any other program associated with it? * How exactly do I use the <embed>...
3
by: happy | last post by:
/* Book name : The prodessional programmers guide to C File name : E:\programs\tc\iti01\ch09\main\01setupm.c Program discription: file setuping -up -Version 01-ver01-W Logic ...
9
by: Audrey | last post by:
Hi, Can I find transitions like on movie maker ? Can I use it on C# program ?
0
by: Madgame | last post by:
urgent... i my computer got virus and all my files are gone... anyone got any software about rental system? rental of books or what? help... need to submit it.... can send me the source code or the...
5
by: mich dobelman | last post by:
I am developing a web crawler which collects info from more than 50,0000 pages. but i am afraid this is going to clog the rental web server if I run it every single day. Is it possible to stop...
15
by: Gujuboy | last post by:
I have assignment to do, but i dont know how to start it off. I read from a text file( also print movies r playing first) , read each line and assign to each string and next line is the price so...
1
by: Lewis | last post by:
am new to c++ and having problems running this program properly. Am suppose to create a data file using Notepad that stores the inputs for the program. Read the data from your input file. Also,...
10
by: NunYoBusiness | last post by:
I just started a C# class and our Professor is not very good at teaching much of anything. We are using the Simply C# book (2003) but are using the VB 2008 program and this weeks lab was to build a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.