HELP C++ As a concierge at a local hotel, you would like to simplify your work w
ID: 3776441 • Letter: H
Question
HELP C++
As a concierge at a local hotel, you would like to simplify your work when ordering taxi rides for your customers. Write a program that will place orders with local taxi companies for your customers.
For your program, implement two classes and a struct. You will have a class for taxi companies, a class for times, and a struct for orders. The class and struct attributes and methods should be as follows:
TIME
TRIP
TAXI
In int main, you should start by establishing an array of three taxi companies. The following properties should be given to each taxi company:
Build a menu system that will allow the user to order a trip, view their cart, or exit.
Ordering a trip should ask the user for the passenger’s name, the number of miles to be driven, and use the Time class method to get the time of the pickup. Create a Trip instance with those pieces of information. Next, display a submenu for the user to choose a taxi company from which to order. Show the cost the trip would be with each company using the calculateTrip class method. Use a for loop to iterate over your taxi company array rather than re-writing the same basic menu option for each company. When the user selects a company to place the order with, us the addTrip class method of the corresponding taxi company to add the Trip instance you created earlier.
Viewing the cart should use a for loop to iterate over the companies in the array, calling the showTrips class method for each.
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
> 2
Active Trips:
$ 0.00 pending with Checker Cab
$ 0.00 pending with GTS Lawrence
$ 0.00 pending with Jayhawk Taxi
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
> 1
What is the passenger's first name? Bob
How many miles would you like to travel? 10
Enter the time with whitespace separating the hours and minutes: 5 45
Which company would you like to place the Trip with?
1. Checker Cab - $30.00
2. GTS Lawrence - $7.00
3. Jayhawk Taxi - $9.00
>2
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
> 2
Active Trips:
$ 0.00 pending with Checker Cab
$ 7.00 pending with GTS Lawrence
Trip scheduled for Bob covering 10 miles with pickup at 05:45 am
$ 0.00 pending with Jayhawk Taxi
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
> 1
What is the passenger's first name? Jane
How many miles would you like to travel? 100
Enter the time with whitespace separating the hours and minutes: 18 20
Which company would you like to place the Trip with?
1. Checker Cab - $30.00
2. GTS Lawrence - $25.00
3. Jayhawk Taxi - $81.00
> 2
===Main Menu===
1. Order a trip
2. View Cart
3. Exit
> 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:45 am
Trip scheduled for Jane covering 100 miles with pickup at 06:20 pm
$ 0.00 pending with Jayhawk Taxi
-int h m stores the time in 24h mode -void rollForward() -int getH() converts h to 12-hour mode, used by print -int getM() returns m, used by print +Time(int h, int m) constructor, sets h and m +Time() constructor, doesn’t set anything +void setTime() asks the user to input time in 24h mode +void print() nicely prints the time in 12h modeExplanation / Answer
//This is incomplete project lack of time , sorry for incomplete and you can finish this only few work has to do
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class TIME
{
private:
int h,m;
public:
TIME(){}
void rollForward();
TIME(int Hr,int Mn)
{
h=Hr;
m=Mn;
}
int getH()
{
return h;
}
int getM()
{
return m;
}
void setTime()
{
cout<<"Enter the time with whitespace separating the hours and minutes:";
cin>>h>>m;
}
void print()
{
cout<<h<<m;
}
};
struct TRIP
{
int miles;
TIME pickup;
string passenger;
};
class TAXI
{
private:
string name;
vector<TRIP>trips;
double rateMiles;
double rateTrips;
public:
TAXI(){}
TAXI(string n,double rM,double rT)
{
name=n;
rateMiles=rM;
rateTrips=rT;
}
string getName()
{
return name;
}
double calculateTrip(struct TRIP t)
{
}
double calculateCart()
{
}
void addTrip(struct TRIP t)
{
}
void showTripx()
{
cout<<""
}
};
int main() {
// your code goes here
int mch,ch;//for choice
struct TRIP t;
TIME tT;
TAXI TX;
while(1){
// float comp[3][2]={{0,30},{0.2,5},{0.8,1}};
cout<<"-------Main Menu---------- ";
cout<<"1.Order a Trip "<<"2.View Cart "<<"3.Exit ";
cin>>mch;
switch(mch)
{
case 1:cout<<"What is the passenger's first name: ";
cin>>t.passenger;
cout<<"How many miles would you like to travel: ";
cin>>t.miles;
tT.setTime();
cout<<"Which company would you like to place the Trip with: ";
cout<<"1.Checker Cab - $30.00 "<<"2.GTS Lawrence - $7.00 "<<"3.Jayhawk Taxi - $9.00 ";
cin>>ch;
break;
case 2:cout<<"Active Trips;"
break;
case 3:exit(0);
}
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.