hello everyone,i'm new to classes but i have adapted well with it. i've been given this task and i'm left with three days to submit.i tried it myself but i just can't get it please help. this is the problem below.

proram 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 firstly my problem is the user has to enter 10 movies in the system,rent them to a customers,each customer has to rent maximum of two movies. the price of renting is 12.50
at the end,i have to print how many movies were rented,to who and the money i have plus how many movies are left.please help. this is what i did below.

#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
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;
	   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";
	 	 
	 }
	 void display()
	 {
		 
         string title,director,actors,name;
         int year,loop,option;
	 	 cout<<"\t\t"<<"VODASHOP MOVIE RENTAL"<<"\n\n";
         cout<<"How many movies to store in the system?:";
         cin>>loop;
         cout<<endl;
         cin.get();

         for(int x=0;x<loop;x++)
		 {
	cout<<"movie information :\n\n";
	cout<<"Title:";
	getline(cin,title);
	cin.get();
	cout<<"Director:";
	cin.get();
	getline(cin,director);
	cout<<"Year produced:";
	cin>>year;
    cout<<endl;
	cin.get();
	cout<<"HOW many actors in this movie?:";
    cin>>option;
    cin.get();
	cout<<endl;
	for(int y=0;y<option;y++)
		
	{ 
		
		cout<<"Actor:";
		getline(cin,actors);
		cout<<"\n";
        SetVideo(title,director,year,actors);
		
	}
	  
	 cout<<endl;
	  	  
	 
	
}
int total=loop;
cout<<"There is :"<<loop<<"\n"<<"Movies in the system\n";
actors=actors;
	 	 
	 }

	 
};
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;
	   Id=13;
	   Name=name;
       Address=address;
	 	 
	 }
	 void GetInfo()
	 {
	   cout<<Id<<"\n"
		   <<Name<<"\n"
		   <<Address<<"\n\n";
	 }
	 void display()
	 {

string id,name,address;
int number;
cout<<"PLEASE ENTER THE CLIENT'S DETAILS:\n\n";
cout<<"ID:";
getline(cin,id);
cout<<"Name:";
cin.get();
getline(cin,name);
cout<<"Address:";
cin.get();
getline(cin,address);
cout<<"how many movies to rent to this customers?The maximum is two:";
cin>>number;
while(number<0 && number>2)
{
	cout<<"enter number of movies:";
	cin>>number;
}
cout<<endl;
cout<<"The movies you entered is/are:\n\n";

    
	}
};


void MenuAndGet(int);

int main()
{


Video myvideo("0","0",0,"0");
Customer myclient("0","0","0");

 	return 0;
}

void MenuAngGet()
{
  cout<<"Please choose the correct option below\n";





}

Recommended Answers

All 4 Replies

your formatting is horrible. Lign up the code so that we all (including you) can read it. Proper indention goes a long way towards understanding.

If you really wrote all that code then I think you are well on your way to completing the assignment yourself. Do the assignment one requirement at a time and start the second requirement only after the first is code, compiled without error and working.

Have a vector of videos.

please help me how to have those vector movies because i haven't used them before and i'm new to this object oriented programming? please help i'm left with 2 days now.i'll appreciate your help.

A vector is just a c++ array and pretty easy to use. Here are the basic functions that you can use. For more indepth information see this tutorial.

#include <vector>
#include <string>
using namespace std;

int main()
{
    // declare the vector of strings
    vector<string> theArray;

    // add a string to the vector
   theArray.push_back("one");

   // get the number of elements in the vector
   int numElements = theArray.size();

   // display all strings
   for(int i = 0; i < theArray.size(); ++i)
       cout << theArray[i] << "\n";

  return 0;
}

In your case, if you want an array of Customer objects, declare it like this

vector<Customer> custArray;

And you can have vectors within classes too. Each customer might have more than one video

class Customer
{
  <snip>

protected:
    vector<Video>  videoArray;
};
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.