63 151
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #5833 in C++ for haruna

Question #5833
develop a program that calculates and displays the total travel expences of a bussiness person on a trip. the program should have functions that ask for and return the following:
- the total number of days spent on the trip
- the time of departure on the first day of the trip. and the time of arrival back home on the last day of the trip.
- miles driven, if a private vehicle was used. calculate the vehicles expences as 0.25 per miles driven.
- parking fees (the company allows up to $6 per day. anything in excess of this must be paid by the employee. )
- taxi fee, if a taxi was used anytime during the trip (the company allows up to $5 per day, for each day a taxi was used. anything in excess of this must be paid by the employee.)
- conference or seminar registration fees.
- hotel expences (the company allow up to $90 per night for lodging. anything in excess of this must be paid by the employee. )
- the amount for meal eating.
the program should calculate and display the total expences incurred.
Expert's answer
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

float price=0, money=0;

void count(){
int totalnumberofdays;
cout<<"Enter the total number of days spent on the trip: ";
cin>>totalnumberofdays;

string timeofdeparture, timeofarrival;
cout<<"Enter time of departure on the first day of the trip: ";
cin>>timeofdeparture;
cout<<"Enter time of arrival back home on the last day: ";
cin>>timeofarrival;

int miles;
cout<<"Enter the number of miles driven, if a private vehicle was used (else type 0): ";
cin>>miles;
price = price + miles*0.25;
money = money + miles*0.25;

float parkingfees;
cout<<"Enter the amount of parking fees: ";
cin>>parkingfees;
if (parkingfees > 6*totalnumberofdays)
& price = price + 6*totalnumberofdays;
else
& price = price + parkingfees;
money = money + parkingfees;

float taxifee;
cout<<"Enter the amount of taxi fee: ";
cin>>taxifee;
if (taxifee > 5*totalnumberofdays)
& price = price + 5*totalnumberofdays;
else
& price = price + parkingfees;
money = money + taxifee;

float conferencefees;
cout<<"Enter the amount of conference and seminar registration fees: ";
cin>>conferencefees;
price = price + conferencefees;
money = money + conferencefees;

float hotelexpences;
cout<<"Enter the hotel expences: ";
cin>>hotelexpences;
if (hotelexpences > 90)
& price = price + 90*totalnumberofdays;
else
& price = price + hotelexpences*totalnumberofdays;
money = money + hotelexpences*totalnumberofdays;

float meal;
cout<<"Enter the amount for meal eating: ";
cin>>meal;
price = price + meal;
money = money + meal;
}

void main(){

count();
cout<<"So, you used $"<<money<<" and you'll receive back $"<<price<<".\r\n";

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions