SlideShare a Scribd company logo
1 of 11
need help with this code
#include
#include
#include
#include
using namespace std;
int main()
{
//define a list of vars & input
double days;
double departure_time;
double arrival_time ;
double airfarefee;
double car_rental;
double milesCost = 0.27;
int privateVehicle, Miles;
double perDay = 6, cost;
double taxi_fee_function;
double total_for_taxi;
double Taxi_company_pays_fee=10; // this is how much
company will pay for the taxi per day
double taxi_company_total_pay=Taxi_company_pays_fee*days;
//this is how much company will pay for the TOTAL taxi
double taxi_cost; // total taxi cost before discounts
double totalReimbursed = 0;
double employeeExpenses = 0;
double totalExpenses = 0;
cout << "How much was the air fare?";
cin >> airfarefee;
cout << "Did you rent a car?";
cin >> car_rental;
cout << "How many days were spent on the trip?";
cin >> days;
cout << "How long was the departure of the trip?";
cin >> departure_time;
cout << "How long was the arrival back home?";
cin >> arrival_time;
//This function calculates the cost for how many miles the user
has driven
//void MilesDriven()
{
double milesCost = 0.27;
int privateVehicle, Miles;
cout << "How many miles did you drive on the trip?" << endl;
cin >> Miles;
cout << "You drove " << Miles << " in total." << endl;
cout << "The total cost of drving your personal vehicle is $" <<
(Miles * milesCost);
}
//This function will calculate whether the employee will be
covered for parking/how how much he will need to pay
//void parkingFees()
{
double perDay = 6, cost;
cout << "The company allows $6 per day for parking." << endl;
cout << "How much was the parking cost for for today?" <<
endl;
cin >> cost;
if(cost < perDay)
{
cout << "You spent " << cost << " on parking today." << endl;
cout << "You will be fully reimbursed." << endl;
}
else
{
cout << "You have spent " << cost << " on parking today and
will need to pay " << (cost - perDay) << " out of pocket." <<
endl;
}
double taxi_fee_function(double total_for_taxi)
{//taxi_fee_function
char taxiused_y_or_n;
double Taxi_company_pays_fee=10; // this is how much
company will pay for the taxi per day
double
taxi_company_total_pay=Taxi_company_pays_fee*days; //this
is how much company will pay for the TOTAL taxi
double taxi_cost; // total taxi cost before discounts
cout <<"Was the taxi used at all during this trip? (Y)es or
(N)o" << endl;
cin >>taxiused_y_or_n; // asking weather taxi was
used or not
if (taxiused_y_or_n =='Y') // IF STATEMENT asking weather
taxi was used or not
{
cout <<"How much did it cost you for your taxi?"<<'n';
cin >>taxi_cost;
double total_for_taxi;
total_for_taxi=taxi_cost-taxi_company_total_pay; //
total for taxi after discounts
if (total_for_taxi<=0) // if number is in negative then make it $0
{
total_for_taxi=0;
}
}
else
{
total_for_taxi=0;
}
return total_for_taxi;
}
}
cout <<"How much was the registeration fee?"<
cin>>reg_fee;
cout <<"How much was the conference fee?"<
cin>>conf_fee;
total_conf_n_reg_fees;
total_conf_n_reg_fees=reg_fee+conf_fee;
return total_conf_n_reg_fees; //Finds the TOTAL of registration
and conference fee
const int NON_NEG = 0;
double days,
departureTime,
arrivalTime,
totalReimbursed = 0,
employeeExpenses = 0,
totalExpenses = 0;
void meals(); //Calculates expenses on meals
void hotelExpenses(); //Calculates expenses on Hotel Fees
void inputVal(double &); //Tests for valid numbers (doubles)
int main()
{
cout << "Please enter the amount of days spent on trip: ";
cin >> days;
inputVal(days);
meals();
hotelExpenses();
system("PAUSE");
return 0;
}
void inputVal(double &num1)
{
while(num1 < NON_NEG)
{
cout << "The number you have entered is invalid." << endl;
cout << "Please enter a number greater than " << NON_NEG <<
":";
cin >> num1;
}
}
void meals()
{
//Input
const int FIRST_BREAKFAST_TIME = 7,
FIRST_LUNCH_TIME = 12,
FIRST_DINNER_TIME = 18,
LAST_BREAKFAST_TIME = 8,
LAST_LUNCH_TIME = 13,
LAST_DINNER_TIME = 19;
const double MAX_BREAKFAST = 9,
MAX_LUNCH = 12,
MAX_DINNER =16;
int numMeals = 0;
double tripMeal,
firstMeal = 0,
lastMeal = 0,
excessMeal = 0,
reimbursedMeal = 0,
totalMeal = 0;
cout << "Please note time is kept in the 24-hour system." <<
endl;
cout << "Please enter your departure time: ";
cin >> departure_time;
inputVal(departure_time);
if(departure_time < FIRST_BREAKFAST_TIME)
{
cout << "You made it in time for Breakfast!" << endl;
cout << "Please enter how much you spent: $";
cin >> firstMeal;
inputVal(firstMeal);
if(firstMeal < MAX_BREAKFAST)
reimbursedMeal += firstMeal;
else
reimbursedMeal += MAX_BREAKFAST;
}
else if(departure_time < FIRST_LUNCH_TIME)
{
cout << "You made it in time for Lunch!" << endl;
cout << "Please enter how much you spent: $";
cin >> firstMeal;
inputVal(firstMeal);
if(firstMeal < MAX_LUNCH)
reimbursedMeal += firstMeal;
else
reimbursedMeal += MAX_LUNCH;
}
else if(departure_time < FIRST_DINNER_TIME)
{
cout << "You made it in time for Dinner!" << endl;
cout << "Please enter how much you spent: $";
cin >> firstMeal;
inputVal(firstMeal);
if(firstMeal < MAX_DINNER)
reimbursedMeal += firstMeal;
else
reimbursedMeal += MAX_DINNER;
}
else
{
cout << "You did not make it in time to eat on the first day. :/"
<< endl;
}
cout << "Please enter your arrival time: ";
cin >> arrival_time;
inputVal(arrival_time);
if(arrival_time < LAST_BREAKFAST_TIME)
{
cout << "You made it in time for Breakfast!" << endl;
cout << "Please enter how much you spent: $";
cin >> lastMeal;
inputVal(lastMeal);
if(lastMeal < MAX_BREAKFAST)
reimbursedMeal += lastMeal;
else
reimbursedMeal += MAX_BREAKFAST;
}
else if(arrival_time < LAST_LUNCH_TIME)
{
cout << "You made it in time for Lunch!" << endl;
cout << "Please enter how much you spent: $";
cin >> lastMeal;
inputVal(lastMeal);
if(lastMeal < MAX_LUNCH)
reimbursedMeal += lastMeal;
else
reimbursedMeal += MAX_LUNCH;
}
else if(arrival_time < LAST_DINNER_TIME)
{
cout << "You made it in time for Dinner!" << endl;
cout << "Please enter how much you spent: $";
cin >> lastMeal;
inputVal(lastMeal);
if(lastMeal < MAX_DINNER)
reimbursedMeal += lastMeal;
else
reimbursedMeal += MAX_DINNER;
}
else
{
cout << "You did not make it in time to eat on the last day. :/"
<< endl;
}
cout << "All the other meals eaten during the trip are fully
reimbursed." << endl;
cout << "Please enter the amount spent on food: $";
cin >> tripMeal;
inputVal(tripMeal);
//Processing
reimbursedMeal += tripMeal;
totalMeal = tripMeal + firstMeal + lastMeal;
if(totalMeal < reimbursedMeal)
excessMeal = 0;
else
excessMeal = totalMeal - reimbursedMeal;
employeeExpenses += excessMeal;
totalExpenses += totalMeal;
//Output
cout << endl;
cout << setprecision(2) << fixed;
cout << "Meal Info" << right << setw(22) << "Amount" << left
<< endl;
cout << "===========" << right << setw(22) <<
"==========" << left << endl;
cout << "Total" << right << setw(28) << totalMeal << left <<
endl;
cout << "Reimbursed" << right << setw(23) << reimbursedMeal
<< left << endl;
cout << "Excess" << right << setw(27) << excessMeal << left
<< endl << endl;
}
void hotelExpenses()
{
//Input
const double HOTEL_MAX = 90;
double totalHotel = 0,
reimbursedHotel = 0,
excessHotel = 0;
vector nightlyHotel(days, 0);
cout << "Please enter the nightly hotel expenses for" << endl;
cout << "the " << int(days) << " days of the trip:" << endl;
for(int counter = 0; counter < days; counter++)
{
cout << "Night " << (counter + 1) << ": $";
cin >> nightlyHotel[counter];
inputVal(nightlyHotel[counter]);
}
//Processing
for(int counter = 0; counter < days; counter++)
{
if(nightlyHotel[counter] < HOTEL_MAX)
reimbursedHotel += nightlyHotel[counter];
else
reimbursedHotel += HOTEL_MAX;
totalHotel += nightlyHotel[counter];
}
if(totalHotel < reimbursedHotel)
excessHotel = 0;
else
excessHotel = totalHotel - reimbursedHotel;
//Output
cout << endl;
cout << setprecision(2) << fixed;
cout << "Hotel Info" << right << setw(22) << "Amount" << left
<< endl;
cout << "============" << right << setw(22) <<
"==========" << left << endl;
cout << "Total" << right << setw(29) << totalHotel << left <<
endl;
cout << "Reimbursed" << right << setw(24) << reimbursedHotel
<< left << endl;
cout << "Excess" << right << setw(28) << excessHotel << left
<< endl << endl;
}
system("pause");
return 0;
}

More Related Content

Similar to need help with this code#include #include #include #includ.docx

@author Jane Programmer @cwid 123 45 678 @class.docx
@author Jane Programmer  @cwid   123 45 678  @class.docx@author Jane Programmer  @cwid   123 45 678  @class.docx
@author Jane Programmer @cwid 123 45 678 @class.docxgertrudebellgrove
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples ajaypeebala
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++NUST Stuff
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.pptLokeshK66
 
Assignment 1 Expository Essay IntroductionIn this assignment, .docx
Assignment 1 Expository Essay IntroductionIn this assignment, .docxAssignment 1 Expository Essay IntroductionIn this assignment, .docx
Assignment 1 Expository Essay IntroductionIn this assignment, .docxsherni1
 
Standing the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider PatternStanding the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider PatternDerek Lee Boire
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++Dendi Riadi
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfseoagam1
 
Programación
ProgramaciónProgramación
ProgramaciónLuci2013
 

Similar to need help with this code#include #include #include #includ.docx (12)

@author Jane Programmer @cwid 123 45 678 @class.docx
@author Jane Programmer  @cwid   123 45 678  @class.docx@author Jane Programmer  @cwid   123 45 678  @class.docx
@author Jane Programmer @cwid 123 45 678 @class.docx
 
Struct
StructStruct
Struct
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples a
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.ppt
 
Assignment 1 Expository Essay IntroductionIn this assignment, .docx
Assignment 1 Expository Essay IntroductionIn this assignment, .docxAssignment 1 Expository Essay IntroductionIn this assignment, .docx
Assignment 1 Expository Essay IntroductionIn this assignment, .docx
 
Standing the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider PatternStanding the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider Pattern
 
Pro.docx
Pro.docxPro.docx
Pro.docx
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdf
 
Programación
ProgramaciónProgramación
Programación
 

More from TanaMaeskm

Nine-year-old Wandas teacher notices that for the past few weeks,.docx
Nine-year-old Wandas teacher notices that for the past few weeks,.docxNine-year-old Wandas teacher notices that for the past few weeks,.docx
Nine-year-old Wandas teacher notices that for the past few weeks,.docxTanaMaeskm
 
Newspapers frequently feature stories on how various democratic prin.docx
Newspapers frequently feature stories on how various democratic prin.docxNewspapers frequently feature stories on how various democratic prin.docx
Newspapers frequently feature stories on how various democratic prin.docxTanaMaeskm
 
New York UniversityType of InstitutionA four-year Private .docx
New York UniversityType of InstitutionA four-year Private .docxNew York UniversityType of InstitutionA four-year Private .docx
New York UniversityType of InstitutionA four-year Private .docxTanaMaeskm
 
Nice thought process and good example of foot into the door” ).docx
Nice thought process and good example of foot into the door” ).docxNice thought process and good example of foot into the door” ).docx
Nice thought process and good example of foot into the door” ).docxTanaMaeskm
 
NIST and Risk Governance and Risk Management Please respond to the.docx
NIST and Risk Governance and Risk Management Please respond to the.docxNIST and Risk Governance and Risk Management Please respond to the.docx
NIST and Risk Governance and Risk Management Please respond to the.docxTanaMaeskm
 
Nice thought process ;)!Some in social media agree with your v.docx
Nice thought process ;)!Some in social media agree with your v.docxNice thought process ;)!Some in social media agree with your v.docx
Nice thought process ;)!Some in social media agree with your v.docxTanaMaeskm
 
Newsletter pertaining to an oceanographic environmental issue 1500.docx
Newsletter pertaining to an oceanographic environmental issue 1500.docxNewsletter pertaining to an oceanographic environmental issue 1500.docx
Newsletter pertaining to an oceanographic environmental issue 1500.docxTanaMaeskm
 
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docx
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docxNicole Martins is the controller at UMC Corp., a publicly-traded man.docx
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docxTanaMaeskm
 
New and Orignal work. Please cite in MLA citation and use in text ci.docx
New and Orignal work. Please cite in MLA citation and use in text ci.docxNew and Orignal work. Please cite in MLA citation and use in text ci.docx
New and Orignal work. Please cite in MLA citation and use in text ci.docxTanaMaeskm
 
New and Origninal work. The topic is already provided below and I ne.docx
New and Origninal work. The topic is already provided below and I ne.docxNew and Origninal work. The topic is already provided below and I ne.docx
New and Origninal work. The topic is already provided below and I ne.docxTanaMaeskm
 
New essay -- minimum 300 words3 resources used NO cover sheet or.docx
New essay -- minimum 300 words3 resources used NO cover sheet or.docxNew essay -- minimum 300 words3 resources used NO cover sheet or.docx
New essay -- minimum 300 words3 resources used NO cover sheet or.docxTanaMaeskm
 
Neurological DisordersNeurological disorders, such as headaches, s.docx
Neurological DisordersNeurological disorders, such as headaches, s.docxNeurological DisordersNeurological disorders, such as headaches, s.docx
Neurological DisordersNeurological disorders, such as headaches, s.docxTanaMaeskm
 
Neurodevelopmental and Neurocognitive Disorders Paper··I.docx
Neurodevelopmental and Neurocognitive Disorders Paper··I.docxNeurodevelopmental and Neurocognitive Disorders Paper··I.docx
Neurodevelopmental and Neurocognitive Disorders Paper··I.docxTanaMaeskm
 
Needs to be done by 8pm central time!!!!!!An important aspect .docx
Needs to be done by 8pm central time!!!!!!An important aspect .docxNeeds to be done by 8pm central time!!!!!!An important aspect .docx
Needs to be done by 8pm central time!!!!!!An important aspect .docxTanaMaeskm
 
Need to know about 504 plan and IEP.  I need to research the process.docx
Need to know about 504 plan and IEP.  I need to research the process.docxNeed to know about 504 plan and IEP.  I need to research the process.docx
Need to know about 504 plan and IEP.  I need to research the process.docxTanaMaeskm
 
Nelson Carson is a 62-year-old man who presents to his private pract.docx
Nelson Carson is a 62-year-old man who presents to his private pract.docxNelson Carson is a 62-year-old man who presents to his private pract.docx
Nelson Carson is a 62-year-old man who presents to his private pract.docxTanaMaeskm
 
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docx
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docxNegotiation strategiesUsing the text Negotiation Readings, Exerc.docx
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docxTanaMaeskm
 
Needs to be done in the next 3-4 hours .docx
Needs to be done in the next 3-4 hours .docxNeeds to be done in the next 3-4 hours .docx
Needs to be done in the next 3-4 hours .docxTanaMaeskm
 
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docx
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docxNeeds quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docx
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docxTanaMaeskm
 
need to work on my present assignment using my last assignment as .docx
need to work on my present assignment using my last assignment as .docxneed to work on my present assignment using my last assignment as .docx
need to work on my present assignment using my last assignment as .docxTanaMaeskm
 

More from TanaMaeskm (20)

Nine-year-old Wandas teacher notices that for the past few weeks,.docx
Nine-year-old Wandas teacher notices that for the past few weeks,.docxNine-year-old Wandas teacher notices that for the past few weeks,.docx
Nine-year-old Wandas teacher notices that for the past few weeks,.docx
 
Newspapers frequently feature stories on how various democratic prin.docx
Newspapers frequently feature stories on how various democratic prin.docxNewspapers frequently feature stories on how various democratic prin.docx
Newspapers frequently feature stories on how various democratic prin.docx
 
New York UniversityType of InstitutionA four-year Private .docx
New York UniversityType of InstitutionA four-year Private .docxNew York UniversityType of InstitutionA four-year Private .docx
New York UniversityType of InstitutionA four-year Private .docx
 
Nice thought process and good example of foot into the door” ).docx
Nice thought process and good example of foot into the door” ).docxNice thought process and good example of foot into the door” ).docx
Nice thought process and good example of foot into the door” ).docx
 
NIST and Risk Governance and Risk Management Please respond to the.docx
NIST and Risk Governance and Risk Management Please respond to the.docxNIST and Risk Governance and Risk Management Please respond to the.docx
NIST and Risk Governance and Risk Management Please respond to the.docx
 
Nice thought process ;)!Some in social media agree with your v.docx
Nice thought process ;)!Some in social media agree with your v.docxNice thought process ;)!Some in social media agree with your v.docx
Nice thought process ;)!Some in social media agree with your v.docx
 
Newsletter pertaining to an oceanographic environmental issue 1500.docx
Newsletter pertaining to an oceanographic environmental issue 1500.docxNewsletter pertaining to an oceanographic environmental issue 1500.docx
Newsletter pertaining to an oceanographic environmental issue 1500.docx
 
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docx
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docxNicole Martins is the controller at UMC Corp., a publicly-traded man.docx
Nicole Martins is the controller at UMC Corp., a publicly-traded man.docx
 
New and Orignal work. Please cite in MLA citation and use in text ci.docx
New and Orignal work. Please cite in MLA citation and use in text ci.docxNew and Orignal work. Please cite in MLA citation and use in text ci.docx
New and Orignal work. Please cite in MLA citation and use in text ci.docx
 
New and Origninal work. The topic is already provided below and I ne.docx
New and Origninal work. The topic is already provided below and I ne.docxNew and Origninal work. The topic is already provided below and I ne.docx
New and Origninal work. The topic is already provided below and I ne.docx
 
New essay -- minimum 300 words3 resources used NO cover sheet or.docx
New essay -- minimum 300 words3 resources used NO cover sheet or.docxNew essay -- minimum 300 words3 resources used NO cover sheet or.docx
New essay -- minimum 300 words3 resources used NO cover sheet or.docx
 
Neurological DisordersNeurological disorders, such as headaches, s.docx
Neurological DisordersNeurological disorders, such as headaches, s.docxNeurological DisordersNeurological disorders, such as headaches, s.docx
Neurological DisordersNeurological disorders, such as headaches, s.docx
 
Neurodevelopmental and Neurocognitive Disorders Paper··I.docx
Neurodevelopmental and Neurocognitive Disorders Paper··I.docxNeurodevelopmental and Neurocognitive Disorders Paper··I.docx
Neurodevelopmental and Neurocognitive Disorders Paper··I.docx
 
Needs to be done by 8pm central time!!!!!!An important aspect .docx
Needs to be done by 8pm central time!!!!!!An important aspect .docxNeeds to be done by 8pm central time!!!!!!An important aspect .docx
Needs to be done by 8pm central time!!!!!!An important aspect .docx
 
Need to know about 504 plan and IEP.  I need to research the process.docx
Need to know about 504 plan and IEP.  I need to research the process.docxNeed to know about 504 plan and IEP.  I need to research the process.docx
Need to know about 504 plan and IEP.  I need to research the process.docx
 
Nelson Carson is a 62-year-old man who presents to his private pract.docx
Nelson Carson is a 62-year-old man who presents to his private pract.docxNelson Carson is a 62-year-old man who presents to his private pract.docx
Nelson Carson is a 62-year-old man who presents to his private pract.docx
 
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docx
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docxNegotiation strategiesUsing the text Negotiation Readings, Exerc.docx
Negotiation strategiesUsing the text Negotiation Readings, Exerc.docx
 
Needs to be done in the next 3-4 hours .docx
Needs to be done in the next 3-4 hours .docxNeeds to be done in the next 3-4 hours .docx
Needs to be done in the next 3-4 hours .docx
 
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docx
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docxNeeds quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docx
Needs quotes and needs to be citied!!about 2 pages.NO PLAGARISM..docx
 
need to work on my present assignment using my last assignment as .docx
need to work on my present assignment using my last assignment as .docxneed to work on my present assignment using my last assignment as .docx
need to work on my present assignment using my last assignment as .docx
 

Recently uploaded

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 

Recently uploaded (20)

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 

need help with this code#include #include #include #includ.docx

  • 1. need help with this code #include #include #include #include using namespace std; int main() { //define a list of vars & input double days; double departure_time; double arrival_time ; double airfarefee; double car_rental; double milesCost = 0.27; int privateVehicle, Miles; double perDay = 6, cost; double taxi_fee_function; double total_for_taxi; double Taxi_company_pays_fee=10; // this is how much company will pay for the taxi per day double taxi_company_total_pay=Taxi_company_pays_fee*days; //this is how much company will pay for the TOTAL taxi double taxi_cost; // total taxi cost before discounts double totalReimbursed = 0; double employeeExpenses = 0; double totalExpenses = 0; cout << "How much was the air fare?"; cin >> airfarefee; cout << "Did you rent a car?"; cin >> car_rental;
  • 2. cout << "How many days were spent on the trip?"; cin >> days; cout << "How long was the departure of the trip?"; cin >> departure_time; cout << "How long was the arrival back home?"; cin >> arrival_time; //This function calculates the cost for how many miles the user has driven //void MilesDriven() { double milesCost = 0.27; int privateVehicle, Miles; cout << "How many miles did you drive on the trip?" << endl; cin >> Miles; cout << "You drove " << Miles << " in total." << endl; cout << "The total cost of drving your personal vehicle is $" << (Miles * milesCost); } //This function will calculate whether the employee will be covered for parking/how how much he will need to pay //void parkingFees() { double perDay = 6, cost; cout << "The company allows $6 per day for parking." << endl; cout << "How much was the parking cost for for today?" << endl; cin >> cost; if(cost < perDay) { cout << "You spent " << cost << " on parking today." << endl;
  • 3. cout << "You will be fully reimbursed." << endl; } else { cout << "You have spent " << cost << " on parking today and will need to pay " << (cost - perDay) << " out of pocket." << endl; } double taxi_fee_function(double total_for_taxi) {//taxi_fee_function char taxiused_y_or_n; double Taxi_company_pays_fee=10; // this is how much company will pay for the taxi per day double taxi_company_total_pay=Taxi_company_pays_fee*days; //this is how much company will pay for the TOTAL taxi double taxi_cost; // total taxi cost before discounts cout <<"Was the taxi used at all during this trip? (Y)es or (N)o" << endl; cin >>taxiused_y_or_n; // asking weather taxi was used or not if (taxiused_y_or_n =='Y') // IF STATEMENT asking weather taxi was used or not { cout <<"How much did it cost you for your taxi?"<<'n'; cin >>taxi_cost; double total_for_taxi; total_for_taxi=taxi_cost-taxi_company_total_pay; // total for taxi after discounts
  • 4. if (total_for_taxi<=0) // if number is in negative then make it $0 { total_for_taxi=0; } } else { total_for_taxi=0; } return total_for_taxi; } } cout <<"How much was the registeration fee?"< cin>>reg_fee; cout <<"How much was the conference fee?"< cin>>conf_fee; total_conf_n_reg_fees; total_conf_n_reg_fees=reg_fee+conf_fee; return total_conf_n_reg_fees; //Finds the TOTAL of registration and conference fee const int NON_NEG = 0; double days, departureTime, arrivalTime, totalReimbursed = 0, employeeExpenses = 0, totalExpenses = 0;
  • 5. void meals(); //Calculates expenses on meals void hotelExpenses(); //Calculates expenses on Hotel Fees void inputVal(double &); //Tests for valid numbers (doubles) int main() { cout << "Please enter the amount of days spent on trip: "; cin >> days; inputVal(days); meals(); hotelExpenses(); system("PAUSE"); return 0; } void inputVal(double &num1) { while(num1 < NON_NEG) { cout << "The number you have entered is invalid." << endl; cout << "Please enter a number greater than " << NON_NEG << ":"; cin >> num1; } } void meals() { //Input const int FIRST_BREAKFAST_TIME = 7, FIRST_LUNCH_TIME = 12, FIRST_DINNER_TIME = 18,
  • 6. LAST_BREAKFAST_TIME = 8, LAST_LUNCH_TIME = 13, LAST_DINNER_TIME = 19; const double MAX_BREAKFAST = 9, MAX_LUNCH = 12, MAX_DINNER =16; int numMeals = 0; double tripMeal, firstMeal = 0, lastMeal = 0, excessMeal = 0, reimbursedMeal = 0, totalMeal = 0; cout << "Please note time is kept in the 24-hour system." << endl; cout << "Please enter your departure time: "; cin >> departure_time; inputVal(departure_time); if(departure_time < FIRST_BREAKFAST_TIME) { cout << "You made it in time for Breakfast!" << endl; cout << "Please enter how much you spent: $"; cin >> firstMeal; inputVal(firstMeal); if(firstMeal < MAX_BREAKFAST) reimbursedMeal += firstMeal; else reimbursedMeal += MAX_BREAKFAST; } else if(departure_time < FIRST_LUNCH_TIME) { cout << "You made it in time for Lunch!" << endl; cout << "Please enter how much you spent: $"; cin >> firstMeal;
  • 7. inputVal(firstMeal); if(firstMeal < MAX_LUNCH) reimbursedMeal += firstMeal; else reimbursedMeal += MAX_LUNCH; } else if(departure_time < FIRST_DINNER_TIME) { cout << "You made it in time for Dinner!" << endl; cout << "Please enter how much you spent: $"; cin >> firstMeal; inputVal(firstMeal); if(firstMeal < MAX_DINNER) reimbursedMeal += firstMeal; else reimbursedMeal += MAX_DINNER; } else { cout << "You did not make it in time to eat on the first day. :/" << endl; } cout << "Please enter your arrival time: "; cin >> arrival_time; inputVal(arrival_time); if(arrival_time < LAST_BREAKFAST_TIME) { cout << "You made it in time for Breakfast!" << endl; cout << "Please enter how much you spent: $"; cin >> lastMeal; inputVal(lastMeal); if(lastMeal < MAX_BREAKFAST) reimbursedMeal += lastMeal; else reimbursedMeal += MAX_BREAKFAST;
  • 8. } else if(arrival_time < LAST_LUNCH_TIME) { cout << "You made it in time for Lunch!" << endl; cout << "Please enter how much you spent: $"; cin >> lastMeal; inputVal(lastMeal); if(lastMeal < MAX_LUNCH) reimbursedMeal += lastMeal; else reimbursedMeal += MAX_LUNCH; } else if(arrival_time < LAST_DINNER_TIME) { cout << "You made it in time for Dinner!" << endl; cout << "Please enter how much you spent: $"; cin >> lastMeal; inputVal(lastMeal); if(lastMeal < MAX_DINNER) reimbursedMeal += lastMeal; else reimbursedMeal += MAX_DINNER; } else { cout << "You did not make it in time to eat on the last day. :/" << endl; } cout << "All the other meals eaten during the trip are fully reimbursed." << endl; cout << "Please enter the amount spent on food: $"; cin >> tripMeal; inputVal(tripMeal); //Processing
  • 9. reimbursedMeal += tripMeal; totalMeal = tripMeal + firstMeal + lastMeal; if(totalMeal < reimbursedMeal) excessMeal = 0; else excessMeal = totalMeal - reimbursedMeal; employeeExpenses += excessMeal; totalExpenses += totalMeal; //Output cout << endl; cout << setprecision(2) << fixed; cout << "Meal Info" << right << setw(22) << "Amount" << left << endl; cout << "===========" << right << setw(22) << "==========" << left << endl; cout << "Total" << right << setw(28) << totalMeal << left << endl; cout << "Reimbursed" << right << setw(23) << reimbursedMeal << left << endl; cout << "Excess" << right << setw(27) << excessMeal << left << endl << endl; } void hotelExpenses() { //Input const double HOTEL_MAX = 90; double totalHotel = 0, reimbursedHotel = 0, excessHotel = 0; vector nightlyHotel(days, 0); cout << "Please enter the nightly hotel expenses for" << endl;
  • 10. cout << "the " << int(days) << " days of the trip:" << endl; for(int counter = 0; counter < days; counter++) { cout << "Night " << (counter + 1) << ": $"; cin >> nightlyHotel[counter]; inputVal(nightlyHotel[counter]); } //Processing for(int counter = 0; counter < days; counter++) { if(nightlyHotel[counter] < HOTEL_MAX) reimbursedHotel += nightlyHotel[counter]; else reimbursedHotel += HOTEL_MAX; totalHotel += nightlyHotel[counter]; } if(totalHotel < reimbursedHotel) excessHotel = 0; else excessHotel = totalHotel - reimbursedHotel; //Output cout << endl; cout << setprecision(2) << fixed; cout << "Hotel Info" << right << setw(22) << "Amount" << left << endl; cout << "============" << right << setw(22) << "==========" << left << endl; cout << "Total" << right << setw(29) << totalHotel << left << endl; cout << "Reimbursed" << right << setw(24) << reimbursedHotel << left << endl; cout << "Excess" << right << setw(28) << excessHotel << left << endl << endl;