question archive C++ programming Fill Help in make Correction in the C++ Coding below to take out errors base on the question You are about to embark on a trip
Subject:Computer SciencePrice: Bought3
C++ programming Fill
Help in make Correction in the C++ Coding below to take out errors base on the question
You are about to embark on a trip. You know your start and finish locations. However, you have not
settled on a formal route for the trip. You will use Google Maps for your trip. To help make the decision,
we will create a trip planning report. The user will enter three alternate routes for the trip which will
have different mileages but will use the same starting and finishing locations. This program can be used
to create a trip report regardless of the mileage of the trip.
The input menus will not specify the route, but will:
• Show a descriptive route name
• A mileage value
• An estimated time (to the nearest decimal - remember, 6 minutes, is 1/10 of an hour- The user
may adjust the time if they wish ) from Google Maps.
• If the route is expected to have any direct route expenses (tolls, ferries, etc.)
• A default value
Menu example:
• Menu 1 - Tampa, Florida via I-75 | 1067.00 |15.33 | N
• Menu 2 - Tampa, Florida via I-77 | 1028.00 | 15.33 | N
• Menu 3 - Tampa, Florida via I-65 | 1124.00 | 16.10 | N
For the final project, you will develop a menu driven trip reporting project which will deliver the
following:
Input
Prior just selecting the menus, the users will be required to enter specific, housekeeping trip information
items which will be used in the above calculations. This will allow the program to be used for the various
scenarios and conditions. I do not want any constants or hard-coded variables in the program unless
they are specifically needed for calculation purposes. The user-specified info required shall be the
following:
• Current cost per gallon for fuel
• Current cost per mile for maintenance.
• Expected fuel mileage for the vehicle.
• Any estimated tolls or direct travel expenses related to the trip. This would include tolls, ferries,
extra charges, etc.
All input fields shall be labeled clearly and concisely.
Output
A trip report which will provide an output to the screen of the following items:
• Start and End Dates formatted (DD/MM/YYYY)
• Trip origin and destination / Route
• Mileage formatted to two decimal places (F2)
• Expected fuel consumption for each trip - Total gallons of fuel consumed (F2)
• Expected time for each trip in rounded to nearest quarter hour (F2)
• Average speed for each trip (F2)
• Costs for the trip, including maintenance, tolls and/or direct travel expense and fuel costs, all
listed as line item costs and then summarized to provide a comprehensive trip report. ($F2)
Specific Requirements
The report inputs and outputs must be clear, concise, and organized.
Each input and output must have a proper descriptor for the input or output.
The inputs and outputs must also demonstrate clarity and be visually pleasant to the consumer.
IMPORTANT - The program must work without question as I will not be asking for resubmissions on the
project. It must be submitted as a .CPP file. Please double check your work prior to submitting your
work.
Please review your project for accuracy in the results. I have a template which I will be using to review
this for accuracy. Minor inconsistencies (such as mileage) are irrelevant. Consider this to be a project
which you are submitting to a client.
The program will consist of various decision structures and functions. The goal of the Final Project is to
confirm that SLO 4.0 has been achieved.
Help in make Correction in the Coding below
Solution
// a program to prompt the user to enter three alternative route for a trip with different milage
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
//declaring trip information
double costPerGallon ;
double costPerMaintance ;
double fuelCost ;
double traveExpenses ;
double totalCost ;
double averageSpeed ;
// declaring the start point
string townA;
string subTownA ;
string townB ;
string subTownB;
string route [3];
double miles[3];
double hours[3];
double extraCost;
int main ()
int menuChoice = 0;
void routeChoices()
char differentWay;
{
for (i = 0; 1 < 3; i ++ )
{
cout << "route " << i + 1 << " main Town Route : " << endl ;
cin >> route i1];
cout << "route " << i+ 1 << "Total miles : " << endl ;
cin >> miles [i];
cout << "route " << i + 1 << "Total hours : " << endl;
cin >> hours[i];
cout << "enter the travel expenses in the route : $ " << endl ;
cin >> travelExpenses [1];
cout << "Is there a different way ? ( y/n) " << endl;
cin >> differentway;
if (differntWay ! = 'y')
break;
}
}
void inputDestination()
{
cout << "The town you are in : " << endl;
cin >> townA;
Cout << "the sub Town you are in : " << endl;
cin >> subTown;
cout << "The town you going to : " << endl;
cin >> townB;
cout << "The town you are in : " << endl;
cin >> townB ;
routchoices ();
}
void inputhousekeepingtripinfo ()
{
cout << "The cost of fuel per gallon : " << endl;
cin >>fuelCost ;
cout << "The cost of maintaince per mile : " << endl;
cin >> costPerMaintance ;
cout << "The average miles per gallon :"<< endl;
cin >> costPerGallon ;
}
// calculate the fuel
double fuelCost()
{
totalGallon =mile [menuchoice -1]/ milepergallon;
fuelCost = totalGallon*costPerGallon;
return totalGallon;
}
// calculate the speed
double speedCalc()
{
average Speed = mile [menuChoice -1]/ hours [menuchoice -1];
return averageSpeed;
}
//calculate maintaince
int maintCalc()
{
maintanceCost = maintanceCost *mile[menuChoice - 1];
return maintanceCost;
}
//calling the options
void displayOptions()
{
cout << "route 1: " << " , " << subTownB << "through " << route [0] << "| " << miles[0] << " | " << hours[0] << endl ;
cout << "route 2: " << " , " << subTownB << "through " << route [1] << "| " << miles[1] << " | " << hours[1] << endl ;
cout << "route 3: " << " , " << subTownB << "through " << route [2] << "| " << miles[2] << " | " << hours[2] << endl ;
cin >> " choose router : (1,2,3) ";
}
// putting inthe start and the end date
void output
{
cout << fixed << showpoint;
cout << setprecision(2) << "miles: " << miles [menuChoice -1 ]<< endl;
cout << " fuel used : " << fuuelCal() << "gallon " << endl;
cout << " total hour : " << hour [menuChoice -1 ]m<< endl;
cout << "average speed : " << speedCal()<< "mph" << endl;
cout << "fuel cost : $ " << fuelCost() << endl ;
cout << "matainace cost: $ " << maintanceCost << endl ;
cout << "expenses cost: $ " << expensesCost[menuChoice-1] << endl ;
cout << "total cost of trip: $" << expenses Cost [menuChoice-1] + maintanceCost + FuelCost << endl;
}
// calling car information
int main ()
{
cout << "putting car information together " << endl ;
inputcarInfor() ;
cout << "putting trip information : " << endl;
input Destination() ;
cout << "choose the route from the options : " << endl;
displayOptions () ;
cout << " calculating final output " << endl;
displayfinaloutput() ;
}