PLEASE EDIT this code if u can .
this is my c++ Assgnment it is about reserving air tickets.
if u can help me 2 insert delete & Edit a air ticket functions to the main menu please please please help me my friendz...
I wz managed 2 save d details in a txt file but i need 2 edit & delete the text file please help me ..& i need 2 insert edit the file & delete the file into d main menu please help me..I hav 2 submit tis on 28 morning plz help me if u can
# include<iostream>
#include<string>
#include<windows.h>
#include<fstream>
using namespace std;
ofstream outf("ticket.txt");
int selct;
char ch;
class passenger{
public:
int age,idno,routeno;
double tic,tic3,tic5;
string to,name,sex;
public:
void ticketprice(){
cout<<" (1) WATCH PRICES "<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<" Route - Economy class - Business class "<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<"- Colombo - - -"<<endl;
cout<<"- to - 070,000 - 086,100 -"<<endl;
cout<<"- Washington - - -"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<"- Colombo - - -"<<endl;
cout<<"- to - 080,000 - 098,400 -"<<endl;
cout<<"- Paris - - -"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<"- Colombo - - -"<<endl;
cout<<"- to - 050,000 - 061,500 -"<<endl;
cout<<"- London - - -"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
cout<<""<<endl;
cout<<""<<endl;
cout<<" ============ "<<endl;
cout<<" = NOTICE = "<<endl;
cout<<" ============ "<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<"*****************************************************************"<<endl;
cout<<"** **IF (AGE <4) 50% DISCOUNT ON THEIR TICKET **"<<endl;
cout<<" **"<<endl;
cout<<""<<endl;
cout<<"** **IF (4 <AGE<15) 25% DISCOUNT ON THEIR TICKET **"<<endl;
cout<<" **"<<endl;
cout<<" **"<<endl;
cout<<"** **IF (15 <AGE<18) 10% DISCOUNT ON THEIR TICKET **"<<endl;
cout<<"*****************************************************************"<<endl;
}
void getdata(){
cout<<" (2) RESERVE A TICKET "<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
cout<<"******************************************************************************"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<"** PLEASE ENTER YOUR NAME HERE : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cin>>name;
outf<<"PASSENGER'S NAME IS : "<<name<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<"** PLEASE ENTER YOUR SEX HERE (male/female) : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cin>>sex;
outf<<"SEX OF THE PASSENGER : "<<sex<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<"** PLEASE ENTER YOUR AGE HERE : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cin>>age;
outf<<"PASSENGER'S AGE IS : "<<age<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<"** PLEASE ENTER YOUR IDENTITY CARD NUMBER HERE : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cin>>idno;
outf<<"PASSENGER'S IDENTITY CARD NUMBER IS :"<<idno<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"******************************************************************************"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<" *********************************"<<endl;
cout<<" *********************************"<<endl;
cout<<" ** (1) Economic Class **"<<endl;
cout<<" ** **"<<endl;
cout<<" ** (2) Business Class **"<<endl;
cout<<" *********************************"<<endl;
cout<<" *********************************"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"Please select one of the above selections :- ";
cin>>selct;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<" The Available Destinations are"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" #####################################"<<endl;
cout<<" ### ###"<<endl;
cout<<" ### 1 - Colombo to Washington ###"<<endl;
cout<<" ### 2 - Colombo to Paris ###"<<endl;
cout<<" ### 3 - Colombo to London ###"<<endl;
cout<<" ### ###"<<endl;
cout<<" #####################################"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"Please select one of the above route numbers :-";
cin>>routeno;
}
double calticprice(){
if(routeno==1){
tic=70000;
}
else if (routeno==2){
tic=80000;
}
else if(routeno==3){
tic=50000;
}
return tic;
}
void calage(){
double tic2=tic;
if(age<=4){
tic3=(tic2*50)/100;
}
else if((age>5)&&(age<=15)){
tic3=(tic2*75)/100;
}
else if((age>16)&&(age<18)){
tic3=(tic2*90)/100;
}
else{
tic3=tic2;
}
}
void display(){
system("cls");
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<" TICKET DETAILS "<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<"%%% NAME OF THE CUSTOMER :"<<name<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"%%% AGE OF THE CUSTOMER :"<<age<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"%%% NIC OF THE CUSTOMER :"<<idno<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"%%% SEAT NUMBER OF THE CUTOMER :"<<seatnum<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"THE FLIGHT NUMBER IS : FL110 "<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"YOUR RESERVED DATE IS : 2009 10 28"<<endl;
cout<<""<<endl;
if(selct==1){
cout<<"TICKET PRICE :"<<tic3<<endl;
}
else if(selct==2){
cout<<"TICKET PRICE :"<<tic5<<endl;
}
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
}
void seatnum(){
int seat;
int seatnum=0;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"DETAILS OF YOUR TICKET HAS BEEN SUCCESSFULLY UPDATED TO OUR COMPANY "<<endl;
cout<<" FINALLY PLEASE ENTER THE SEAT NUMBER - ";
cin>>seat;
cout<<endl;
if(seatnum!=seat){
seatnum=seat;
cout<<"SUCCESSFUL"<<endl;
}
else{
cout<<"SORRY"<<endl;
if(seatnum!=seat){
seatnum=seat;
cout<<"SUCCESSFUL"<<endl;
}
}
}
};
class economic:public passenger{
public:
void getdata(){
passenger::getdata();
}
void calticprice2(){
passenger::calticprice();
}
void seatnum(){
passenger::seatnum();
}
};
class business:public passenger{
public:
void getdata(){
passenger::getdata();
}
void calticprice3(){
passenger::calticprice();
double tic4=tic;
if(age<=4){
tic5=(tic4*123/100)*50/100;
}
else if((age>=5)&&(age<=15)){
tic5=(tic4*123/100)*75/100;
}
else if((age>16)&&(age<18)){
tic5=(tic4*123/100)*90/100;
}
else{
tic5=(tic4*123)/100;
}
}
void seatnum(){
passenger::seatnum();
}
};
//void seatnum();
int main(){
int menuselect;
char c;
passenger p1;
do{
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
cout<<"******************************************************************************"<<endl;
cout<<"* *"<<endl;
cout<<"* WELCOME TO THE TRAVEL LINE AIRLINE TRANSPORTATION COMPANY *"<<endl;
cout<<"* *"<<endl;
cout<<"* TICKET RESERVATION PROGRAM *"<<endl;
cout<<"* *"<<endl;
cout<<"* *"<<endl;
cout<<"******************************************************************************"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~ MAIN MENU ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (1) Watch the prices ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (2) Reserve a ticket ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"Please select one of the above selections :-";
cin>>menuselect;
if(menuselect==1){
system("cls");
p1.ticketprice();
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"do u want to Reserve a ticket(y/n)";
cin>>c;
if(c=='y')
{
system("cls");
p1.getdata();
p1.calticprice();
p1.calage();
p1.seatnum();
p1.display();
}
else if(c=='n'){
cout<<"Thank you Very much for using our travelline ticket reservation program good bye"<<endl;
system("cls");
}
}
else if(menuselect==2){
system("cls");
if(selct=1){
//case 1:
economic e1;
e1.getdata();
e1.calticprice2();
e1.calage();
e1.seatnum();
e1.display();
//break;
}
else if(selct=2){
business b1;
b1.getdata();
b1.calticprice3();
b1.calage();
b1.seatnum();
b1.display();
//break;
}
else{
cout<<"Invalid selection"<<endl;
}
//}
//else if(select==2){
}
cout<<"DO U WANT TO CONTINUE?(y/n) ";
cin>>ch;
}while(ch!='n');
return 0;
}