Dear all,
Maysomeone help me with this functions?
I have entries in my classes and I need to initialize entries into other classes.
To be more specific:
I have Customers and Flights and I need to use this fuction to insert customers to random destinations.
arkoenig 340 Practically a Master Poster
Please post the code you have written so far, and explain what problems you having in getting it to work.
mbouster 0 Light Poster
Actually is a programming assignment project . I must not publish the code but what i actually did is create the classes , Customers , Flights and Flight Operators.
I will actually place my code here
/*Classes declarations*/
/**********************************************************************************************************************************/
/*Class Customers*/
class Customers {
public:
Customers(){}
int customer_id;// custom assigned number of the customer to uniquely identify in the system
int id; //national ID number of the customer in order to search if not allready in the system
string name;
string address;
int postal_code;
string email_addess;
int phone_number;
int membership; // Kind of membership ->Economy=1/Silver=2/Gold=3
/* functions*/
Customers(int CID, int ID, string N, string A, int p, int m)
{
customer_id=CID;
id=ID;
name=N;
address=A;
postal_code=p;
membership=m;
}
int addCustomers();
int getCustomers();
int searchCustomers();
int updateCustomers();
};
/*end class Customers*/
/**********************************************************************************************************************************/
/*Class FlightOperators*/
class FlightOperators {
public:
FlightOperators(){}
string name;
string Address;
/*functions*/
FlightOperators(string N, string A)
{
name=N;
Address=A;
}
void addFlightOperators();
void getFlightOperators();
void searchFlightOperators();
};
//FlightOperators CyprusAirways, BritishAirways, OlympicAirlines;
void FlightOperators::addFlightOperators()
{
}
void FlightOperators::getFlightOperators()
{
}
void FlightOperators::searchFlightOperators()
{
}
/*end Class FlightOperators*/
/**********************************************************************************************************************************/
/*Class Flights*/
class Flights{
public:
Flights(){}
string flight_code;
string departure;
string destination;
int seats; // avaliable seats based on the flight
int departuredate; //the format will be ddmmyyyy
// int departuretime; // the format will be 24 hours of the format if its 6:30 in the afternoon 1830
int phone_number;
//functions
Flights(string FC, string Dp,string Ds, int s,int dd)
{
flight_code=FC;
departure=Dp;
destination=Ds;
seats=s;
departuredate=dd;
}
void setFlights();
void getFlights();
void searchFlights();
void updateFlights();
};
void Flights::setFlights()
{
cout<<"Set flights"<<endl;
}
void Flights::getFlights()
{
cout<<"Get flights"<<endl;
}
void Flights::searchFlights()
{
cout<<"Search flights"<<endl;
}
void Flights::updateFlights()
{
cout<<"Updateflights"<<endl;
}
/*end Class Flights*/
/**********************************************************************************************************************************/
I create another function to create instances of each class but i dont know how to use the rand and srand
/* Initialize data*/
int initializedata()
{
//Customers(int CID, int ID, string N, string A, int p, int m) function prototype
Customers Lefteris(1,801423,"Lefteris Zacharia", "Saint Gregoriou 1", 99669805, 2);
Customers Zacharias(2,801723,"Zacharias Zachariou", "Ithakis 3", 99617525, 1);
Customers Eleni(3,901723,"Eleni Zachariou", "Ithakis 3", 99617525, 1);
Customers Demetriana(4,1001723,"Demetriana Zachariou", "Ithakis 3", 99617525, 1);
Customers George(5,111723,"Geroge Zachariou Aresti", "Saint Gregoriou 1", 99617525, 1);
Customers Christina(6,901723,"Christina Zachariou", "Ithakis 8", 99617525, 1);
Customers Antri(7,801223,"Antri Zachariou", "Ithakis 3", 99617525, 1);
Customers Marios(8,901113,"Marios Charalambous", "Ithakis 8", 99617525, 1);
//FlightOperators(string N, string A, int p) function prototype
FlightOperators CY ("Cyprus Airways", "Engomi Nicosia");
FlightOperators BA ("British Airways", "London England");
FlightOperators OA ("Olympic Airlines", "Athens");
//Flights(string FC, string Dp,string Ds, int s,int dd) function prototype CY326, CY327, BA625, BA628; OA325, OA326
Flights CY326 ("CY326", "Larnaca" ,"London", 326, 27122010);
Flights CY327 ("CY327", "London" ,"Larnaca", 315, 28122010);
Flights BA625 ("BA625", "London" ,"Larnaca", 615, 27122010);
Flights BA628 ("BA625", "Larnaca" ,"London", 615, 28122010);
Flights OA325 ("OA325", "Athens" ,"Cairo", 310, 29122010);
Flights OA326 ("OA326", "Cairo" ,"Athens", 315, 30122010);
return 0;
}
/*End Initialize data*/
I have one more problem . How to dynamically initialize 150 customers lets say with 100 different flights.
Do I need to create more classes with destinations, date etc???
Thanks
w
Please post the code you have written so far, and explain what problems you having in getting it to work.
Edited by mike_2000_17 because: Fixed formatting
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.