作业代写-c++案例business trip
Assignment 3 Code Peer Reviews Due: Thursday, 2/7/19, 11:59pm
Assignment 3 Code Back Evaluations: Sunday, 2/10/19, 11:59pm
Go to Peerceptiv and complete your 3 peer reviews by Thursday at midnight. After Thursday at midnight, you will evaluate how helpful your peer reviews are by Sunday at midnight.
Assignment #4: Functions (150 pts) Design Due: Sunday, 2/10/19, 11:59pm
Design Peer Reviews Due: Thursday, 2/14/19, 11:59pm Code and Design Back Evaluations: Sunday, 2/17/19, 11:59pm
(10 pts) Assignment 3 Reflective Post-Peer Review Survey:
http://oregonstate.qualtrics.com/jfe/form/SV_6tKS9w33C0x0eHj
Problem statement
Creating business trip expense reports is common practice. Suppose a businessperson just completed a business trip for your company. Now, you are tasked to write a program that calculates the total travel reimbursement to the businessperson and the actual amount they spent. The program should prompt the user for the following:
The number of days spent on the trip
The departure time on the first day of the trip, and arrival time on the last day of the trip
The amount of airfare
Conference or seminar registration fees
Rent a car or use taxis during the trip
If car rented, then you must prompt for the rental car type, total rental fee, total gas fee, total miles driven, and parking fees for each day
If a taxi was taken, then calculate taxi fees for each day
Hotel expenses for each day, if number of days spent on the trip is greater than 1
The total travel expenses and reimbursement are calculated as follows:
Both airfare and registration fees can be reimbursed
If a car was rented, the maximum reimbursement expense for each car type and gas fee per mile are listed in the following table:
Car type
Maximum allowed Rental fee per day ($)
Maximum allowed Gas fee per mile driven ($)
Sedan
20
0.24
SUV
25
0.27
Van
30
0.32
Convertible
50
0.45
The total expense for the car is: total rental fee + total gas fee
The maximum reimbursement for the car is: max allowed rental fee per day for a car type
* number of days of the trip + max allowed gas fee per mile * total miles driven
If a car was rented, the company allows up to $6 for parking per day. Anything beyond this must be paid by the businessperson.
If a taxi was used anytime during the trip, the company allows up to $10 per day.
Anything beyond this must be paid by the businessperson.
The company allows up to $90 per night for hotel expense. Anything beyond this must be paid by the businessperson.
The amount of each meal eaten. On the first day of the trip, a meal is allowed as an expense if the time of departure is BEFORE (and including) …
Meal type
Departure time
Breakfast
7 am
Lunch
12 noon
Dinner
6 pm
For example, if departure time is 6:30 am, all 3 meals on the first day are reimbursed, if departure time is 9 am, only lunch and dinner on the first day are reimbursed.
On the last day of the trip, a meal is allowed as an expense if the time of arrival is AFTER (and including) …
Meal type
Arrival time
Breakfast
8 am
Lunch
1 pm
Dinner
7 pm
For example, if arrival time is 7:30 am, all 3 meals on the last day are NOT reimbursed, if arrival time is 5 pm, only breakfast and lunch on the last day are reimbursed.
The company allows up to $9 for breakfast, $12 for lunch, and $16 for dinner. Anything beyond this must be paid by the employee.
Reimbursement rule for the company:
If a payment goes beyond the maximal allowable amount for a certain item, the businessperson gets the maximal allowable amount reimbursed, otherwise, the
businessperson gets how much he or she paid reimbursed.
For example, if the businessperson spent $120 for the hotel first night and $70 for the second night, and spent $10 for the dinner first night and $20 for the second (both meals are allowed to reimburse), then the allowable expenses for these two items are 90 + 70 + 10 + 16 = 186.
Example run:
Enter the number of days on your trip: abb Invalid input! Enter again: 3
Enter your departure time on the first day: 8.00 Enter your arrival time on the last day: 17.30
Enter total amount of airfare, in $: 586.53
Enter total conference or seminar registration fees, in $: 26.50
Did you 1: rent a car or 2: use taxi for your trip? Enter 1 or 2: 1 Enter total spent on the rental car in $: 150.00
Enter your total gas fee spent in $: 25.64
Sedan
SUV
Van
Convertible
Enter your rental car type: 2
Enter the total miles driven, in miles: 130
Enter parking fee for day 1, in $: 3.6 Enter parking fee for day 2, in $: 12 Enter parking fee for day 3, in $: 5.8
Enter hotel fee for night 1, in $: 100.34 Enter hotel fee for night 2, in $: 88.63
Day 1,
Your breakfast for day 1 is not allowed as an expense Enter lunch fee, in $: 12.10
Enter dinner fee, in $: 18.69
Day 2,
Enter breakfast fee, in $: 10.77 Enter lunch fee, in $: 8.50
Enter dinner fee, in $: 12.18
Day 3,
Enter breakfast fee, in $: 4.36 Enter lunch fee, in $: 16.81
Your dinner for day 3 is not allowed as an expense
Your total expense for this trip is: $1082.45 Your total reimbursement for this trip is: $981.74
Do you want to calculate another business expense report (0-no or 1-yes)? 0
Design Document – Due Sunday 2/10/19, 11:59pm Refer to the Example Polya Document – Polya_template.pdf
Step 1: Understanding the Problem/Problem Analysis. (15 pts)
Do you understand everything in the problem? List anything you do not fully understand, and make sure to ask a TA or instructor about anything you do not understand.
What are the user inputs/requirements, program outputs, etc.? (5 pts)
What assumptions are you are making? (5 pts)
What are all the tasks and subtasks in this problem? (5 pts)
Step 2: Program Design. (25 pts)
What does the overall big picture of this program look like? (flowchart or pseudocode) (20 pts)
What data do you need to create, when do you read input from the user?
What are the decisions that need to be made in this program?
What tasks are repeated?
How would you modularize the program, how many functions are you going to create, and what are they?
What kind of bad input are you going to handle? (5 pts)
Based on your answers above, list the specific steps or provide a flowchart of what is needed to create. Be very explicit!!!
Step 4: Program Testing. (10 pts)
Create a test plan with the test cases (bad, good, and edge cases). What do you hope to be the expected results?
What are the good, bad, and edge cases for ALL input in the program? Make sure to provide enough of each and for all different inputs you get from the user.
Program Code – Due Sunday 2/17/19, 11:59pm
(80 pts) Implementation Requirements:
Must produce a working program that follows each rule stated above
Your user interface must provide clear instructions for the user and information about the data being presented
The program should never end until the user tells you to
Use of references OR pointers is required, a couple of suggested functions are listed below:
//update total_expense and total_reimbursement
void update_total (float &total_expense, float &total_reimbursement, float expense_to_add, float reimbursement_to_add);
//calculate the total vehicle expense and reimbursement fee void car_rental (int days_of_trip, float &car_expense);
//calculate the total meal expense and reimbursement fee
void meal_fee (int days_of_trip, double departure_time, double arrival_time, double &meal_expense, double &meal_reimbursement);
Your program should be properly decomposed into tasks and subtasks using functions.
To help you with this, use the following:
Make each function do one thing and one thing only
No more than 15-20 lines inside the curly braces of any function, including main(). Whitespace, variable declarations, single curly braces, vertical spacing,
comments, and function headers do not count.
Functions over 20 lines need justification in comments
Do not put multiple statements into one line
Error checking:
Re-prompt user for any bad inputs (includes other data types)
Do not accept negative numbers for any dollar amount or for miles driven
Do not accept number less than 1 for the number of days
Only accept valid times for the time of departure and the time of arrival
No global variables allowed (those declared outside of many or any other function), global constants are allowed
goto is NOT allowed
Allowed built-in functions: atoi(), atof(), is_digit()
Make sure you follow the style guidelines, have a program and function headers with appropriate comments, and be consistent
(10 pts) Assignment 4 Predictive Pre-Peer Review Survey:
http://oregonstate.qualtrics.com/jfe/form/SV_5BCu3SCewiwbs7X