Question: Problem 3 Background Financial and logistical calculations are found in every type of engineering, particularly industrial and systems engineering and civil engineering. Problem Statement You

 Problem 3 Background Financial and logistical calculations are found in every

Problem 3 Background Financial and logistical calculations are found in every type of engineering, particularly industrial and systems engineering and civil engineering. Problem Statement You are a civil engineer who wishes to evaluate whether or not driving to a gas station x miles away where gas is n cents cheaper is a money save or not. In other words, the problem you wish to solve is, "If I am at Station A and it costs $x.xx per gallon, and gas at Station B is cheaper and costs $x.xx will save money by driving x miles to Station B to get gas?" Since a major goal of this assignment is to gain experience with user written functions, you are required to create a function in addition to the script file. Create a function named Cost that has gallons of gas purchased and price per gallon as its inputs and returns the total cost as its output. Instructions. Create a function file named Cost.m that: - Calculates the cost of gas without printing any variables to the screen In the script file, Class_24_App.m perform the following tasks: - Ask the user for the number of miles their car typically travels on one gallon of gas and the number of gallons needed. - Ask the user the price of gas at Station A and Station B. - Calculate the cost of filling up at Station A using the function Cost). - Calculate the cost of filling up at Station Busing the function Cost().- Ask the user for the distance between Station A and Station B. - Calculate the cost of driving to Station B from Station A with the distance from A to B and the price at Station B using the function Cost(). - Compare the costs of filling up at Station A with the costs of travelling to and filling up at station B. - Based on the cost calculations, display a message that indicates one of the following three options: (1) the savings for buying gas at Station B, (2) the additional cost for buying gas at Station B, or (3) that there is no cost difference. - Repeat the program until the user chooses to quit. For testing purposes please use the following inputs for the file you submit: Testing Conditions Number of miles per gallon their car typically gets = 25 mpg Number of gallons needed = 10 gal. Price of Gas at Station A = $2.45 Price of Gas at Station B = $2.15 Distance between A and B = 30 miles Repeat Number of miles per gallon their car typically gets = 20 mpg Number of gallons needed = 5 gal. Price of Gas at Station A = $2.30 Price of Gas at Station B = $2.20 Distance between A and B = 5 miles Repeat Number of miles per gallon their car typically gets = 40 mpg Number of gallons needed = 15 gal. Price of Gas at Station A = $2.50 Price of Gas at Station B = $2.40 Distance between A and B = 25 miles End Problem 3 Background Financial and logistical calculations are found in every type of engineering, particularly industrial and systems engineering and civil engineering. Problem Statement You are a civil engineer who wishes to evaluate whether or not driving to a gas station x miles away where gas is n cents cheaper is a money save or not. In other words, the problem you wish to solve is, "If I am at Station A and it costs $x.xx per gallon, and gas at Station B is cheaper and costs $x.xx will save money by driving x miles to Station B to get gas?" Since a major goal of this assignment is to gain experience with user written functions, you are required to create a function in addition to the script file. Create a function named Cost that has gallons of gas purchased and price per gallon as its inputs and returns the total cost as its output. Instructions. Create a function file named Cost.m that: - Calculates the cost of gas without printing any variables to the screen In the script file, Class_24_App.m perform the following tasks: - Ask the user for the number of miles their car typically travels on one gallon of gas and the number of gallons needed. - Ask the user the price of gas at Station A and Station B. - Calculate the cost of filling up at Station A using the function Cost). - Calculate the cost of filling up at Station Busing the function Cost().- Ask the user for the distance between Station A and Station B. - Calculate the cost of driving to Station B from Station A with the distance from A to B and the price at Station B using the function Cost(). - Compare the costs of filling up at Station A with the costs of travelling to and filling up at station B. - Based on the cost calculations, display a message that indicates one of the following three options: (1) the savings for buying gas at Station B, (2) the additional cost for buying gas at Station B, or (3) that there is no cost difference. - Repeat the program until the user chooses to quit. For testing purposes please use the following inputs for the file you submit: Testing Conditions Number of miles per gallon their car typically gets = 25 mpg Number of gallons needed = 10 gal. Price of Gas at Station A = $2.45 Price of Gas at Station B = $2.15 Distance between A and B = 30 miles Repeat Number of miles per gallon their car typically gets = 20 mpg Number of gallons needed = 5 gal. Price of Gas at Station A = $2.30 Price of Gas at Station B = $2.20 Distance between A and B = 5 miles Repeat Number of miles per gallon their car typically gets = 40 mpg Number of gallons needed = 15 gal. Price of Gas at Station A = $2.50 Price of Gas at Station B = $2.40 Distance between A and B = 25 miles End

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!