Join 135,998 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,384 people online right now. Registration is fast and FREE... Join Now!
This is a Rent aCar program where i have done everything but i have found 2 errors which i am not able to correct.Please help!!
CODE
//************************************************************************* // The Rent A Car Program // //*************************************************************************
//************************************************************************* //class for the car details. //************************************************************************* class cars {public: char carreg[15]; int carno; char ac; int cartype; char modelname[20]; int rate; char caravail; void accept(); void display(); void getrate(); void modicar(int cno); void delcar(int cno); };
//************************************************************************* //function to accept the details of the cars //************************************************************************* void cars:: accept() {cout<<"\nEnter the car number(used for referance):"; cin>>carno; cout<<"\nEnter the registration number of car:"; gets(carreg); cout<<"Enter the model name of car:"; gets(modelname); do {cout<<"Specify whether car has air conditioning(y-yes,n-no)"; cin>>ac; }while(tolower(ac)!='y'||tolower(ac)!='n'); cout<<"\nSpecify the car type:"; cout<<"\n1.Small Car.\n2.Luxury Car.\n3.SUV(8 seater)"; do {cout<<"\nPlease enter your choice by choosing the option's number"; cin>>cartype; }while(cartype!=1 || cartype!=2 || cartype!=3); cout<<"\nIs the car available for renting out?"; cout<<"\n(y for yes and n for no)"; do {cin>>caravail; if(tolower(caravail)!='y'|| tolower(caravail)!='n') cout<<"Please enter y for yes and n for no"; } while(tolower(caravail)!='y'|| tolower(caravail)!='n'); }
//************************************************************************* //Function to display the records of the cars. //************************************************************************* void cars::display() {cout<<"----------------------------------------------"; cout<<"\nCar Number :"<<carno; cout<<"\nCar Registration Number :"<<carreg; cout<<"\nCar Model Number :"; puts(modelname); cout<<"Air Conditioning Available:"; if(tolower(ac)=='y') cout<<"Yes"; else if(tolower(ac)=='n') cout<<"No"; cout<<"\nCar type :";
while(cartype!=1 || cartype!=2 || cartype!=3) {switch(cartype) {case 1:cout<<"Small Car"; break; case 2:cout<<"Luxury Car"; break; case 3:cout<<"SUV(8 seater)"; break; } } cout<<"----------------------------------------------"; } //************************************************************************* //Function to determine the rate of a car. //************************************************************************* void cars::getrate() {switch(ac) {case 'y': case 'Y':switch(cartype) {case 1:rate=350; break; case 2:rate=450; break; case 3:rate=550; break; } break; case 'n': case 'N':switch(cartype) {case 1:rate=300; break; case 2:rate=400; break; case 3:rate=500; break; } break; } }
//************************************************************************* //Function to modify the details of a car //************************************************************************* void cars::modicar(int cno) {cars c; int flag=0,rec=0; fstream fop; fop.open("cars.dat",ios::binary|ios::in|ios::out); while(!fop.eof()) {fop.read((char*)& c,sizeof(cars)); rec++; if(cno==c.carno) {cout<<"\nThis car's details are as follows:"; c.display(); cout<<"\nWould you still like to modify the details"; char ch; cout<<"\ny for yes and n for no"; if(tolower(ch)=='y') {c.accept(); fop.seekg((rec-1)*sizeof(cars),ios::beg); fop.write((char*)& c,sizeof(cars)); flag=1; } break; } } if(flag==0) cout<<"No car with such a car number exists!"; else cout<<"The record has been modified successfully!"; fop.close(); }
//************************************************************************* //Function to delete the records of a car //************************************************************************* void cars::delcar(int cno) {cars c; ifstream fin; ofstream fout; int flag=0; fin.open("cars.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &c,sizeof(cars)); if(c.carno!=cno) fout.write((char*) &c,sizeof(cars)); else flag=1; } if(flag==0) cout<<"No such car with that car number!"; else cout<<"The cars details have been successfully deleted"; fin.close(); fout.close(); remove("cars.dat"); rename("Temp.dat","cars.dat"); }
//************************************************************************* //Class for the customer details. //************************************************************************* class customer {public: char name[26]; char houseno[11]; char street[21]; char city[11]; long telno; void put_data(); void get_data(); void modicust(long tel); void delcust(long tel); };
//************************************************************************* //Function to accept the customer details. //************************************************************************* void customer::get_data() { cout<<"\nEnter the name of the person:"; gets(name); cout<<"\nEnter the House number:"; gets(houseno); cout<<"\nEnter the street address:"; gets(street); cout<<"\nEnter the city:"; gets(city); cout<<"\nEnter the telephone number"; cin>>telno; }
//************************************************************************* //Function to display the details of the customers. //************************************************************************* void customer::put_data() { cout<<"\nName : ";gets(name); cout<<"\nHouse.No.: ";gets(houseno); cout<<"\nStreet : ";gets(street); cout<<"\nCity : ";gets(city); cout<<"\nTelephone: "<<telno; }
//************************************************************************* //Function to modify the records of a customer //************************************************************************* void customer::modicust(long tel) {customer c; int flag=0,rec=0; fstream fop; fop.open("customer.dat",ios::binary); while(!fop.eof()) {fop.read((char*)& c,sizeof(customer)); rec++; if(c.telno==tel) {cout<<"\nThe details of this customer are:"; c.put_data(); cout<<"\nDo you still want to modify the customer's record?"; cout<<"\ny for yes and n for no"; char ch; cin>>ch; if(tolower(ch)=='y') {c.get_data(); fop.seekg((rec-1)*sizeof(customer),ios::beg); fop.write((char*)& c,sizeof(customer)); flag=1; break; } } } if(flag==0) cout<<"\nSuch a customer does not exist!"; else cout<<"\The customer's record has been successfully modified!"; fop.close(); }
//************************************************************************* //Function to delete the records of a customer //************************************************************************* void customer::delcust(long tel) {customer c; ifstream fin; ofstream fout; int flag=0; fin.open("customer.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &c,sizeof(customer)); if(c.telno!=tel) fout.write((char*) &c,sizeof(customer)); else flag=1; } if(flag==0) cout<<"No customer with that telephone number exists!"; else cout<<"The customer details have been successfully deleted"; fin.close(); fout.close(); remove("customer.dat"); rename("Temp.dat","customer.dat"); }
//************************************************************************* //Class for the details of the rental. //************************************************************************* class rent:public cars,public customer {public: char name[26],model[20]; long tele; int days; int carnum; void disptrans(); void transac(long tel); void deltrans(long tel); void moditrans(long tel); void canceltrans(long tel); };
//************************************************************************* //Function to display the records of a transaction //************************************************************************* void rent::disptrans() {cout<<"---------------------------------------------"; cout<<"Customer Name:";puts(name); cout<<"Car Model:";puts(model); cout<<"Rent Period:"<<days; cout<<"---------------------------------------------"; }
//************************************************************************* //Function to create a new transaction //************************************************************************* void rent::transac(long tel) {fstream fin; ofstream fout; customer c; cars ca; int choi,num; rent r; fin.open("customer.dat",ios::binary); while(!fin.eof()) {fin.read((char*)&c ,sizeof(customer)); if(c.telno==tel) {r.tele=c.telno; strcpy(r.name,c.name); } } fin.close(); fin.open("cars.dat",ios::binary); cout<<"\nChoose type of car:"; cout<<"\n1.Small Car\n2.Luxury Car\n3.SUV(8 seater)"; cout<<"\nChoose the option by giving the option number."; cin>>choi; cout<<"The available cars are:"; while(!fin.eof()) {fin.read((char*)& ca,sizeof(cars)); if(choi==ca.cartype) {if(tolower(ca.caravail)=='y') cout<<"Car Number:"<<ca.carno; cout<<"Model:"; puts(ca.modelname); cout<<"------------------------------------"; } } cout<<"Please choose the car you would like by giving the car number."; cin>>num; while(!fin.eof()) {fin.read((char*)& ca,sizeof(cars)); if(ca.carno==num) {r.carnum==ca.carno; strcpy(r.model,ca.modelname); break; } else cout<<"no such car"; } cout<<"\nPlease enter the period for rent out(max.7 days)"; do {cin>>num; if(num>7) cout<<"Sorry!The max rental period is 7"; }while(num>7); r.days=num; fout.open("Rent.dat",ios::binary|ios::app); fout.write((char*) &r,sizeof(rent)); fin.close(); fout.close(); }
//************************************************************************* //Function to delete a particular transaction //************************************************************************* void rent::deltrans(long tel) {rent r; ifstream fin; ofstream fout1; ofstream fout2; int flag=0; fin.open("Rent.dat",ios::binary); fout1.open("Temp.dat",ios::binary); fout2.open("Rentlog.dat",ios::binary|ios::app); while(!fin.eof()) {fin.read((char*) &r,sizeof(rent)); if(r.tele!=tel) fout1.write((char*) &r,sizeof(rent)); else if(r.tele==tel) fout2.write((char*) &r,sizeof(rent)); else flag=1; } if(flag==0) cout<<"Telephone number does not exist!"; else cout<<"The transaction has been successfully deleted"; fin.close(); fout1.close(); fout2.close(); remove("Rent.dat"); rename("Temp.dat","Rent.dat"); }
//************************************************************************* //Function to cancel a transaction //************************************************************************* void rent::canceltrans(long tel) {rent r; ifstream fin; ofstream fout; int flag=0; fin.open("Rent.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &r,sizeof(rent)); if(r.tele!=tel) fout.write((char*) &r,sizeof(rent)); else flag=1; } if(flag==0) cout<<"No customer with that telephone number has rented a car!"; else cout<<"The transaction has been successfully deleted"; fin.close(); fout.close(); remove("Rent.dat"); rename("Temp.dat","Rent.dat"); }
//************************************************************************* //Function to modify a transaction //************************************************************************* void rent::moditrans(long tel) {rent r; int flag=0,rec=0; fstream fop; fop.open("Rent.dat",ios::binary|ios::in|ios::out); while(!fop.eof()) {fop.read((char*) &r,sizeof(rent)); rec++; if(tel==r.tele) {cout<<"\nThe transaction details are as follows:"; r.disptrans(); cout<<"\nDo you still wish to modify the transaction?"; char ch; cout<<"\n(y for yes n for no)"; cin>>ch; if(tolower(ch)=='y') {r.transac(tel); fop.seekg((rec-1)*sizeof(rent),ios::beg); fop.write((char*)& r,sizeof(rent)); flag=1; break; } if(flag==0) cout<<"No customer with that telephone number has rented a car!"; else cout<<"The transaction has been successfully been modified!"; fop.close(); } }
//************************************************************************* //Function to calculate the total rent of the transaction //************************************************************************* void calc(long tel) {cars c; rent r; int cno,rate,days; ifstream fin1; ifstream fin2; fin1.open("cars.dat",ios::binary); fin2.open("rent.dat",ios::binary); while(!fin2.eof()) {fin2.read((char*)& r,sizeof(rent)); if(r.tele==tel) {cno=r.carnum; days=r.days; } } while(!fin1.eof()) {fin1.read((char*)& c,sizeof(cars)); if(cno==c.carno) rate=c.rate; } total=days*rate; cout<<"\nThe Payment Details:"; cout<<"\nNo of Days:"<<days; cout<<"\nRate:Rs."<<rate; cout<<"\nTotal:Rs."<<total; }
//************************************************************************* //Function Display the scrolling text marquee. //************************************************************************* void marquee() { int gd=DETECT,gm; int i; initgraph(&gd,&gm,""); settextstyle(1,0,5); settextjustify(1,1); for(i=0;i<getmaxx();i++) { setcolor(YELLOW); outtextxy(getmaxx()-i,getmaxy()/2,"Geo Car Rental"); delay(10); setcolor(getbkcolor()); outtextxy(getmaxx()-i,getmaxy()/2,"Geo Car Rental"); } }
if you fix these and recompile you then get a lot more errors!
It looks as though you implemented this code in one go - it is better to develope a few functions at a time and test them, e.g. class data members and constructors then test it, then add get and set functions, then overloaded operators, etc etc
This post has been edited by horace: 27 Nov, 2006 - 09:20 AM
hey man i have corrected ur program it contained 30errors(not 2) & still many but it is in working form iam posting code here
CODE
//************************************************************************* // The Rent A Car Program // //*************************************************************************
//************************************************************************* //class for the car details. //************************************************************************* class cars {public: char carreg[15]; int carno; char ac; int cartype; char modelname[20]; int rate; char caravail; void accept(); void display(); void getrate(); void modicar(int cno); void delcar(int cno); };
//************************************************************************* //function to accept the details of the cars //************************************************************************* void cars:: accept() {clrscr(); cout<<"\nEnter the car number(used for referance):"; cin>>carno; cout<<"\nEnter the registration number of car:"; gets(carreg); cout<<"Enter the model name of car:"; gets(modelname); do {cout<<"Specify whether car has air conditioning(y-yes,n-no)"; cin>>ac; }while((tolower(ac)!='y')&&(tolower(ac)!='n')); cout<<"\nSpecify the car type:"; cout<<"\n1.Small Car.\n2.Luxury Car.\n3.SUV(8 seater)"; do {cout<<"\nPlease enter your choice by choosing the option's number"; cin>>cartype; }while(cartype!=1 && cartype!=2 && cartype!=3); cout<<"\nIs the car available for renting out?"; cout<<"\n(y for yes and n for no)"; do {cin>>caravail; if(tolower(caravail)!='y'&& tolower(caravail)!='n') cout<<"Please enter y for yes and n for no"; } while(tolower(caravail)!='y'&& tolower(caravail)!='n'); }
//************************************************************************* //Function to display the records of the cars. //************************************************************************* void cars::display() {clrscr(); cout<<"----------------------------------------------"; cout<<"\nCar Number :"<<carno; cout<<"\nCar Registration Number :"<<carreg; cout<<"\nCar Model Number :"; puts(modelname); cout<<"Air Conditioning Available:"; if(tolower(ac)=='y') cout<<"Yes"; else if(tolower(ac)=='n') cout<<"No"; cout<<"\nCar type :";
while(cartype!=1 && cartype!=2 && cartype!=3) {switch(cartype) {case 1:cout<<"Small Car"; break; case 2:cout<<"Luxury Car"; break; case 3:cout<<"SUV(8 seater)"; break; } } cout<<"----------------------------------------------"; } //************************************************************************* //Function to determine the rate of a car. //************************************************************************* void cars::getrate() {clrscr(); switch(ac) {case 'y': case 'Y':switch(cartype) {case 1:rate=350; break; case 2:rate=450; break; case 3:rate=550; break; } break; case 'n': case 'N':switch(cartype) {case 1:rate=300; break; case 2:rate=400; break; case 3:rate=500; break; } break; } }
//************************************************************************* //Function to modify the details of a car //************************************************************************* void cars::modicar(int cno) {clrscr(); cars c; int flag=0,rec=0; fstream fop; fop.open("cars.dat",ios::binary|ios::in|ios::out); while(!fop.eof()) {fop.read((char*)& c,sizeof(cars)); rec++; if(cno==c.carno) {cout<<"\nThis car's details are as follows:"; c.display(); cout<<"\nWould you still like to modify the details"; char ch; cout<<"\ny for yes and n for no"; if(tolower(ch)=='y') {c.accept(); fop.seekg((rec-1)*sizeof(cars),ios::beg); fop.write((char*)& c,sizeof(cars)); flag=1; } break; } } if(flag==0) cout<<"No car with such a car number exists!"; else cout<<"The record has been modified successfully!"; fop.close(); }
//************************************************************************* //Function to delete the records of a car //************************************************************************* void cars::delcar(int cno) {clrscr(); cars c; ifstream fin; ofstream fout; int flag=0; fin.open("cars.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &c,sizeof(cars)); if(c.carno!=cno) fout.write((char*) &c,sizeof(cars)); else flag=1; } if(flag==0) cout<<"No such car with that car number!"; else cout<<"The cars details have been successfully deleted"; fin.close(); fout.close(); remove("cars.dat"); rename("Temp.dat","cars.dat"); }
//************************************************************************* //Class for the customer details. //************************************************************************* class customer {public: char name[26]; char houseno[11]; char street[21]; char city[11]; long telno; void put_data(); void get_data(); void modicust(long tel); void delcust(long tel); };
//************************************************************************* //Function to accept the customer details. //************************************************************************* void customer::get_data() {clrscr(); cout<<"\nEnter the name of the person:"; gets(name); cout<<"\nEnter the House number:"; gets(houseno); cout<<"\nEnter the street address:"; gets(street); cout<<"\nEnter the city:"; gets(city); cout<<"\nEnter the telephone number"; cin>>telno; }
//************************************************************************* //Function to display the details of the customers. //************************************************************************* void customer::put_data() { clrscr(); cout<<"\nName : ";gets(name); cout<<"\nHouse.No.: ";gets(houseno); cout<<"\nStreet : ";gets(street); cout<<"\nCity : ";gets(city); cout<<"\nTelephone: "<<telno; }
//************************************************************************* //Function to modify the records of a customer //************************************************************************* void customer::modicust(long tel) {clrscr(); customer c; int flag=0,rec=0; fstream fop; fop.open("customer.dat",ios::binary); while(!fop.eof()) {fop.read((char*)& c,sizeof(customer)); rec++; if(c.telno==tel) {cout<<"\nThe details of this customer are:"; c.put_data(); cout<<"\nDo you still want to modify the customer's record?"; cout<<"\ny for yes and n for no"; char ch; cin>>ch; if(tolower(ch)=='y') {c.get_data(); fop.seekg((rec-1)*sizeof(customer),ios::beg); fop.write((char*)& c,sizeof(customer)); flag=1; break; } } } if(flag==0) cout<<"\nSuch a customer does not exist!"; else cout<<"\The customer's record has been successfully modified!"; fop.close(); }
//************************************************************************* //Function to delete the records of a customer //************************************************************************* void customer::delcust(long tel) {clrscr(); customer c; ifstream fin; ofstream fout; int flag=0; fin.open("customer.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &c,sizeof(customer)); if(c.telno!=tel) fout.write((char*) &c,sizeof(customer)); else flag=1; } if(flag==0) cout<<"No customer with that telephone number exists!"; else cout<<"The customer details have been successfully deleted"; fin.close(); fout.close(); remove("customer.dat"); rename("Temp.dat","customer.dat"); }
//************************************************************************* //Class for the details of the rental. //************************************************************************* class rent:public cars,public customer {public: char name[26],model[20]; long tele; int days; int carnum; void disptrans(); void transac(long tel); void deltrans(long tel); void moditrans(long tel); void canceltrans(long tel); }; void calc(long tel); //************************************************************************* //Function to display the records of a transaction //************************************************************************* void rent::disptrans() {clrscr(); cout<<"---------------------------------------------"; cout<<"Customer Name:";puts(name); cout<<"Car Model:";puts(model); cout<<"Rent Period:"<<days; cout<<"---------------------------------------------"; }
//************************************************************************* //Function to create a new transaction //************************************************************************* void rent::transac(long tel) {clrscr(); fstream fin; ofstream fout; customer c; cars ca; int choi,num; rent r; fin.open("customer.dat",ios::binary); while(!fin.eof()) {fin.read((char*)&c ,sizeof(customer)); if(c.telno==tel) {r.tele=c.telno; strcpy(r.name,c.name); } } fin.close(); fin.open("cars.dat",ios::binary); cout<<"\nChoose type of car:"; cout<<"\n1.Small Car\n2.Luxury Car\n3.SUV(8 seater)"; cout<<"\nChoose the option by giving the option number."; cin>>choi; cout<<"The available cars are:"; while(!fin.eof()) {fin.read((char*)& ca,sizeof(cars)); if(choi==ca.cartype) {if(tolower(ca.caravail)=='y') cout<<"Car Number:"<<ca.carno; cout<<"Model:"; puts(ca.modelname); cout<<"------------------------------------"; } } cout<<"Please choose the car you would like by giving the car number."; cin>>num; while(!fin.eof()) {fin.read((char*)& ca,sizeof(cars)); if(ca.carno==num) {r.carnum=ca.carno; strcpy(r.model,ca.modelname); break; } else cout<<"no such car"; } cout<<"\nPlease enter the period for rent out(max.7 days)"; do {cin>>num; if(num>7) cout<<"Sorry!The max rental period is 7"; }while(num>7); r.days=num; fout.open("Rent.dat",ios::binary|ios::app); fout.write((char*) &r,sizeof(rent)); fin.close(); fout.close(); }
//************************************************************************* //Function to delete a particular transaction //************************************************************************* void rent::deltrans(long tel) {clrscr(); rent r; ifstream fin; ofstream fout1; ofstream fout2; int flag=0; fin.open("Rent.dat",ios::binary); fout1.open("Temp.dat",ios::binary); fout2.open("Rentlog.dat",ios::binary|ios::app); while(!fin.eof()) {fin.read((char*) &r,sizeof(rent)); if(r.tele!=tel) fout1.write((char*) &r,sizeof(rent)); else if(r.tele==tel) fout2.write((char*) &r,sizeof(rent)); else flag=1; } if(flag==0) cout<<"Telephone number does not exist!"; else cout<<"The transaction has been successfully deleted"; fin.close(); fout1.close(); fout2.close(); remove("Rent.dat"); rename("Temp.dat","Rent.dat"); }
//************************************************************************* //Function to cancel a transaction //************************************************************************* void rent::canceltrans(long tel) {clrscr(); rent r; ifstream fin; ofstream fout; int flag=0; fin.open("Rent.dat",ios::binary); fout.open("Temp.dat",ios::binary); while(!fin.eof()) {fin.read((char*) &r,sizeof(rent)); if(r.tele!=tel) fout.write((char*) &r,sizeof(rent)); else flag=1; } if(flag==0) cout<<"No customer with that telephone number has rented a car!"; else cout<<"The transaction has been successfully deleted"; fin.close(); fout.close(); remove("Rent.dat"); rename("Temp.dat","Rent.dat"); }
//************************************************************************* //Function to modify a transaction //************************************************************************* void rent::moditrans(long tel) { clrscr(); rent r; int flag=0,rec=0; fstream fop; fop.open("Rent.dat",ios::binary|ios::in|ios::out); while(!fop.eof()) { fop.read((char*) &r,sizeof(rent)); rec++; if(tel==r.tele) { cout<<"\nThe transaction details are as follows:"; r.disptrans(); cout<<"\nDo you still wish to modify the transaction?"; char ch; cout<<"\n(y for yes n for no)"; cin>>ch; if(tolower(ch)=='y') { r.transac(tel); fop.seekg((rec-1)*sizeof(rent),ios::beg); fop.write((char*)& r,sizeof(rent)); flag=1; break; } if(flag==0) cout<<"No customer with that telephone number has rented a car!"; else cout<<"The transaction has been successfully been modified!"; } } fop.close();
}
//************************************************************************* //Function to calculate the total rent of the transaction //************************************************************************* void calc(long tel) { cars c; rent r; int cno,rate,days; ifstream fin1; ifstream fin2; fin1.open("cars.dat",ios::binary); fin2.open("rent.dat",ios::binary); while(!fin2.eof()) {fin2.read((char*)& r,sizeof(rent)); if(r.tele==tel) {cno=r.carnum; days=r.days; } } while(!fin1.eof()) {fin1.read((char*)& c,sizeof(cars)); if(cno==c.carno) rate=c.rate; } int total=days*rate; cout<<"\nThe Payment Details:"; cout<<"\nNo of Days:"<<days; cout<<"\nRate:Rs."<<rate; cout<<"\nTotal:Rs."<<total; }
//************************************************************************* //Function Display the scrolling text marquee. //************************************************************************* void marquee() { int gd=DETECT,gm; int i; initgraph(&gd,&gm,""); settextstyle(1,0,5); settextjustify(1,1); for(i=0;i<getmaxx();i++) { setcolor(YELLOW); outtextxy(getmaxx()-i,getmaxy()/2,"Geo Car Rental"); delay(10); setcolor(getbkcolor()); outtextxy(getmaxx()-i,getmaxy()/2,"Geo Car Rental"); } closegraph(); }
//*************************************************************************// //The Main function //*************************************************************************// void main() { clrscr(); customer cust; cars car; rent rental; ofstream fout; ifstream fin; char choi; marquee(); do { clrscr(); gotoxy(28,9); cprintf("Car Rental Menu"); cout<<"\n(a).New Car"; cout<<"\n(b).New Customer"; cout<<"\n(c).New Transaction"; cout<<"\n(d).Modify Car Details"; cout<<"\n(e).Modify Customer Details"; cout<<"\n(f).Modify Transaction Details"; cout<<"\n(g).Delete Car Details"; cout<<"\n(h).Delete Customer Details"; cout<<"\n(i).Delete Transaction"; cout<<"\n(j).Cancel Transaction"; cout<<"\n(k).View Customer History"; cout<<"\n(l).View Payment Details"; cout<<"\n(m).Exit"; char ch1,ch; ch1=getche(); ch=toupper(ch1); switch(ch) { case 'A': cout<<"New Car"; car.accept(); fout.open("cars.dat",ios::binary|ios::app); fout.write((char*)& car,sizeof(cars)); cout<<"The Car Details have been added successfully!"; fout.close(); break; case 'B': cout<<"New Customer"; cust.get_data(); fout.open("customer.dat",ios::binary|ios::app); fout.write((char*)&cust,sizeof(customer)); cout<<"The Customer Details have been added successfully!"; fout.close(); break; case 'C': cout<<"New Transaction"; cout<<"Please Enter the customer's telephone number"; long tel; cin>>tel; fin.open("customer.dat",ios::binary|ios::app); fin.read((char*)& cust,sizeof(customer)); if(cust.telno==tel) rental.transac(tel); else { cout<<"\nNo customer has this phone number in our database"; cout<<"\nWould you like to add this customer to our data base?"; cout<<"\n(y for yes and n for no)"; char c; cin>>c; if(tolower(c)=='y') { cust.get_data(); fout.open("customer.dat",ios::binary|ios::app); fout.write((char*)& cust,sizeof(customer)); cout<<"\nCustomer has been added"; fout.close(); cout<<"\nYou may proceed with the transaction details"; rental.transac(tel); } } break; case 'D': cout<<"\nModify Car Details"; int cno; cout<<"\nPlease Enter the car number"; cin>>cno; car.modicar(cno); break; case 'E': cout<<"\nModify Customer Details"; long tel1; cout<<"\nPlease Enter the customer's telephone number"; cin>>tel1; cust.modicust(tel1); break; case 'F': cout<<"\nModify Transaction Details"; long tel2; cout<<"\nPlease enter the customer's telephone number"; cin>>tel2; rental.moditrans(tel2); break; case 'G': cout<<"\nDelete Car Details"; int cno1; cout<<"\nPlease enter the car number"; cin>>cno1; car.delcar(cno1); break; case 'H': cout<<"\nDelete Customer Details"; long tel3; cout<<"Please enter the car number"; cin>>tel3; cust.delcust(tel3); break; case 'I': cout<<"\nDelete Transaction"; cout<<"\nWarning:This option is to delete the transaction "; cout<<"only once the rental is over"; cout<<"\nTo cancel a transaction please use option (j)."; cout<<"\nDo you still want to proceed?(yes or no)"; char ch; cin>>ch; if(tolower(ch)=='y') { cout<<"\nPlease enter the customer's telephone number"; long tel; cin>>tel; rental.deltrans(tel); cout<<"\nThe transaction has been moved to rent history log"; break; } else if(tolower(ch)=='n') { cout<<"\nPlease run option (j). to cancel transaction"; break; } else { cout<<"Sorry,Wrong Choice!"; break; } case 'J': cout<<"Cancel Transaction"; cout<<"\nPlease enter the customer's telephone number"; long tel4; cin>>tel4; rental.canceltrans(tel4); break; &