Hello! So I have a school project where I'm supposed to manage a taxi company using c++ programs (especially class and struct) and my question is how to make my output what the teacher wants it to be.
His output wants it too look like if you inputted the Bob/Jane for passenger and they traveled 10/100 with GTS Lawrence:
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
>(input 2)
Active Trips:
$ 0.00 pending with Checker Cab
$ 32.00 pending with GTS Lawrence
Trip scheduled for Bob covering 10 miles with pickup at 05:45am
Trip scheduled for Jane covering 100 miles with pickup at 06:20pm
$ 0.00 pending with Jayhawk Taxi
My output if I do the same thing is(shortened):
$0.00 trips pending with Checker Cab
$ 25 trip for Jane is pending with GTS Lawrence
$ 7 trip for Bob is pending with GTS Lawrence
$0.00 trips pending with Jayhawk Taxi
What I would like help with is changing my code so it better matches his output, so that it has the total pending charge for a company, but also inputs an indented line for the passenger name/the amount of miles/and the pickup time. Another thing I would like help with is changing my outputs of numbers from "25" and "7" into something that looks like "25.00" and "7.00". Any help will be appreciated!
int main()
{
Taxi t[3]= {Taxi("Checker Cab",0,30), Taxi("GTS Lawrence",0.20,5), Taxi("Jayhawk Taxi",0.8,1)};
int hr, min;
Trip tr;
int choice;
do
{
cout << "--Main Menu--"<<endl<<"1. Order a Trip"<<endl<<"2. View Cart"<<endl<<"3. Exit"<<endl;
cin>>choice;
switch (choice)
{
case 1:
cout<<"What is the passenger's first name? "<<endl;
cin>>tr.passenger;
cout<<"How many miles would they like to travel? "<<endl;
cin>>tr.Miles;
cout<<"When would they like to travel?"<<endl;
tr.pickup.setTime();
cout<<"Please select the taxi company they would like to travel with"<<endl;
for(int x=0; x<3; x++)
cout<<x+1<<"."<<t[x].calculateTrip(tr)<<endl;
cin>>choice;
t[choice].addTrip(tr);
continue;
case 2:
cout<<"Active Trips:"<<endl;
for(int x=0; x<3; x++)
t[x].calculateCart();
continue;
case 3:
cout<<"Ending program... Have a nice trip!"<<endl;
break;
}
}
while (choice!=3);
return 0;
}