Menu

[Solved]1 25 Points Write Matlab Function Called Tripcost Following Form Function Totalcost Indivi Q37235468

1. (25 points) Write a MATLAB function called tripCost with the following form function (totalcost, individualcost] tripcost(1. (25 points) Write a MATLAB function called tripCost with the following form function (totalcost, individualcost] tripcost(aileRate) end This function is used to help employees of your company in submitting expense reports. The function arguments are defined as follows: The per-mile reimbursement rate in cents ($0.01) The total cost of the trip in dollars The per-person cost of the trip in dollars mileRate . Input 1: Output 1: totalCost Output 2: individualCost The function should do the following: 1. Ask the user to enter the name of destina 2. Ask the u 3. Ask the user 4. Calculate the total cos 5. Calculate the per-person cost in dolla 6. Print a formatted report using fprintf tion using the input function ser to enter the total driving distance in miles using the input function to enter the number of people who went using the input function t in dollars and store in the appropriate output argument cost in dollars and store in the appropriate output argument and output must be formatted exactly as shown in the example run below, including , a The interactive Inpon and whitespace. Be sure to display the correct number of decimal places in the wording, punctuation report! Note: you do not have to check the inputs f ample Run (your command line should look exactly like this when run with the same inputs): – tripcostrs4.5) the destination?: Detroit the total driving distance, in mites?: 454 le vent on the trip?: 5 reinbursenent is $247.43 for 5 people travelling to Detroit! person reimbursenent is $49.49 4300 Show transcribed image text 1. (25 points) Write a MATLAB function called tripCost with the following form function (totalcost, individualcost] tripcost(aileRate) end This function is used to help employees of your company in submitting expense reports. The function arguments are defined as follows: The per-mile reimbursement rate in cents ($0.01) The total cost of the trip in dollars The per-person cost of the trip in dollars mileRate . Input 1: Output 1: totalCost Output 2: individualCost The function should do the following: 1. Ask the user to enter the name of destina 2. Ask the u 3. Ask the user 4. Calculate the total cos 5. Calculate the per-person cost in dolla 6. Print a formatted report using fprintf tion using the input function ser to enter the total driving distance in miles using the input function to enter the number of people who went using the input function t in dollars and store in the appropriate output argument cost in dollars and store in the appropriate output argument and output must be formatted exactly as shown in the example run below, including , a The interactive Inpon and whitespace. Be sure to display the correct number of decimal places in the wording, punctuation report! Note: you do not have to check the inputs f ample Run (your command line should look exactly like this when run with the same inputs): – tripcostrs4.5) the destination?: Detroit the total driving distance, in mites?: 454 le vent on the trip?: 5 reinbursenent is $247.43 for 5 people travelling to Detroit! person reimbursenent is $49.49 4300

Expert Answer


Answer to 1. (25 points) Write a MATLAB function called tripCost with the following form function (totalcost, individualcost] trip… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *