Write a C++ program to perform various calculations related to the fuel economy of a vehicle where the fuel economy is modeling using a polynomial of the form y = Ax2 + Bx + C, where
y = fuel economy in miles per gallon (mpg)
x = speed in miles per hour (mph)
In particular:
Inputs: The user should be prompted to input the following information.
The values for coefficients A, B, and C used to model the fuel efficiency
The capacity of the fuel tank (in gallons).
The current amount of fuel in the tank (in gallons).
The current speed of the vehicle (in mpg)
The distance to be travelled on the current trip (in miles)
The cost per gallon for gasoline
The minimum speed, Smin, to be used in the table of Fuel Economy vs Speed
The maximum speed, Smax, to be used in the table of Fuel Economy vs Speed
The speed increment, Sinc, to be used in the table of Fuel Economy vs Speed
Functions: The program should use at least 4 user-defined functions (in addition to main) as described below.
MPG(A, B, C, Speed) – This function returns the fuel economy in mpg for a given speed in mph.
PrintTable(Smin, Smax, Sinc A, B, C) – This function will print a table of Speed (in mpg) and Fuel Economy (in mpg).
Use the range of speeds indicated with the speed increment indicated.
This function should call the function MPG above.
Fuel economy should be calculated using the coefficients A, B, and C provided.
Include a table heading with units.
Display speeds as integers and fuel economy with 2 digits after the decimal point (include trailing zeros).
MaxEconomy(Smin, Smax, Sinc A, B, C, MaxMPG, MaxMPH) – This function will return the maximum mpg and the corresponding speed value using the speed range and increment specified. This function should call the function MPG above.
Use at least one more useful (user-defined) function to calculate one or more of the program outputs.
Outputs: The program output should include the following:
Neatly summarize the input values
A table of Speed and Fuel Economy values (created by the PrintTable function above).
The maximum fuel economy (in mpg) and the corresponding speed (determined by the MaxEconomy function above).
The fuel economy (in mpg) at the current speed
The minimum fuel economy (in mph) and the corresponding speed. Note: This does not always occur at the minimum speed.
For the current speed, trip distance, number of gallons currently in the tank, and cost per gallon for fuel (show the value of each), display the following:
The fuel economy (in mpg)
Speed for the trip (in mph)
The fuel cost for the trip.
The number of gallons that will be used for the trip.
The time to reach the destination.
State how many times you will need to stop for gas. Assume that the tank must be filled when it is 10% full.
State the number of gallons of gas will be left in the tank at the end of the trip.
State the number of miles until the next time the tank must be filled (after the trip).
Repeat the above if you drive at the speed for maximum fuel economy. Also state how many gallons of gas were saved and how much money was saved by driving at the speed for maximum fuel efficiency.
Use a suitable number of digits for all numeric outputs and include units when appropriate.
Error Checks: The program should check for appropriate ranges for inputs and allow the user to re-enter any incorrect inputs, including:
Fuel tank capacity: 0 to 20 gallons
Current amount of fuel in tank: 20% - 100% of fuel tank capacity
Current speed of vehicle: 20 to 80 mph
Distance to be travelled: Must be > 0
Cost per gasoline: Must be > 0
Minimum speed for table (Smin): Integer value where 20 < Smin < 50
Maximum speed for table (Smax): Integer value where (Smin + 10) < Smax < 80
Speed increment for table (Sinc): Integer value where 0 < Sinc < (Smax – Smin)/5
Re-running the Program: Include a loop that will give the user the option of re-running the program.
In: Computer Science
Consider a Rankine cycle with an ideal intermediate steam pickup, one of which is open and the other is closed feed water heaters. The steam enters the turbine at 12.5 MPa pressure and 550 degrees Celsius temperature and expands to 10 kPa condenser pressure. The steam separated from the turbine at 0.8 MPa pressure is sent to the closed feed water heater and the steam separated at 0.3 MPa pressure is sent to the open feed water heater. The feed water is heated to the condensing temperature of the steam leaving the turbine in the closed heater. The steam comes out of the closed heater as a saturated liquid, then the pressure is lowered into a valve and sent to the open feed water heater. Show the cycle in a T-s diagram with saturated liquid and saturated vapor curves.
a)
Water flow that must pass through the boiler for the production of 250 MW net power,
b)
Calculate the thermal efficiency of the cycle.
In: Mechanical Engineering
You are the account manager in charge of Internet advertising at Impact Sales. Spending on Internet advertising has increased steadily over the last few years and you predict the growth will continue.
) Do you think a linear model is appropriate for this data? Explain clearly.
f) Find a quadratic model for this data since 2000.
g) Which model better fits your data? Support your answer with a scatter plot of the data and both models on the same set of axis.
h) Using the quadratic model what is the average rate of change between 2002 and 2004?
i) As the account manager what would you budget for Internet advertising in 2008?
TABLE:
Year Internet Advertising Spending (Billions)
2001 0
2002 0.3
2003 0.8
2004 1.9
2005 3
2006 4.3
2007 5.8
In: Advanced Math
Using the data, fit an appropriate regression model to determine
whether
time spent studying (hours) is a useful predictor of the chance of
passing the exam (result, 0=fail 1=pass). Formally assess
the overall fit of the model.
DATA three;
INPUT result hours;
/* result=0 is fail; result=1 is pass */
cards;
0 0.8
0 1.6
0 1.4
1 2.3
1 1.4
1 3.2
0 0.3
1 1.7
0 1.8
1 2.7
0 0.6
0 1.1
1 2.1
1 2.8
1 3.4
1 3.6
0 1.7
1 0.9
1 2.2
1 3.1
0 1.4
1 1.9
0 0.4
0 1.6
1 2.5
1 3.2
1 1.7
1 1.9
0 2.2
0 1.3
1 1.5
;
run;
In: Statistics and Probability
For a sample of 12 trees, the volume of lumber (in m3) and the diameter ( in cm ) at a fixed height above the ground level was measured. The results were as follows.
Use Excel sheet
| Diameter | Volumes |
|---|---|
| 35.1 | 0.81 |
| 48.4 | 1.39 |
| 47.9 | 1.31 |
| 35.3 | 0.67 |
| 47.3 | 1.46 |
| 26.4 | 0.47 |
| 33.8 | 0.8 |
| 45.3 | 1.69 |
| 25.2 | 0.3 |
| 28.5 | 0.19 |
| 30.1 | 0.63 |
| 30 | 0.64 |
a)Construct a scatterplot of volume ( y ) versus diameter ( x ). using Excel
b)Compute the least-square line for predicting volume from diameter.
c)Compute the fitted value and residual for each point. d)If two trees differ in diameter by 8 cm, by how much would you predict their volume to differ?
e)Predict the volume of a tree whose diameter is 44 cm.
f)For what diameter would you predict a volume of 1m3
In: Statistics and Probability
Davy Metal Company produces brass fittings. Davy's engineers estimate the production function represented below as relevant for their long-run capital-labor decisions.
? = 500? 0.6? 0.8 where Q = annual output measured in pounds, L = labor measured in person-hours, K = capital measured in machine hours. The marginal products of labor and capital are:
??? = 300? −0.4? 0.8 ; ??? = 400? 0.6? −0.2
Davy's employees are relatively highly skilled and earn $15 per hour. The firm estimates a rental charge of $50 per hour on capital. Davy forecasts annual costs of $500,000 per year, measured in real dollars.
a. Determine the firm's optimal capital-labor ratio, given the information above.
b. How much capital and labor should the firm employ, given the $500,000 budget? Calculate the firm's output.
c. Davy is currently negotiating with a newly organized union. The firm's personnel manager indicates that the wage may rise to $22.50 under the proposed union contract. Analyze the effect of the higher union wage on the optimal capital-labor ratio and the firm's employment of capital and labor. What will happen to the firm's output?
d. Graph the optimal bundles before and after wage change in the same diagram. K on y axis and L on x axis.
In: Economics
Determine the positive real root of ln(x^2)=0.8 by the following methods. (Note that you need to show the details of your derivations in MATLAB).
a) Graphically ( plot the function and copy your figure to word).
b) Using two iterations of the bisection method with initial guesses of xl=0.4 and xu=2 and populate the following table. What is the root after two iterations? Provide justification for the values you have obtained in your MATLAB code as comments.
i xl xu xr
1 0.4 2
2
c) Using two iterations of the false position method, with the same initial guesses as in b) and populate the table below. What is the root after two iterations? Provide justification for the values you have obtained in your MATLAB code as comments.
i xl xu xr
1 0.4 2
2
d) Compute the actual root of the function (use a built in MATLAB function) and identify which method (bisection or false position) achieves a better estimate of the root after two iterations. Prove your answer by calculating the True Percentage Error ( Assume that your answer in part d, obtained using the MATLAB Built in Function is the true value ). ALL Calculations must be performed in MATLAB.
In: Advanced Math
Consider a hotel which can supply an unlimited number of hotel rooms at the constant marginal cost c = 20 per room per night, so that the hotel’s total cost function is given by C(q) = 20q.1 Assume that demand for hotel rooms in Tallahassee takes two possible values: on game days, demand is described by the demand curve q = 100 − p, while on non-game-days demand is described by the demand curve q = 60 − 2p.
First suppose that the hotel acts as a price taker.
(a) What does it mean for the hotel to act as a price taker? What condition determines a price taker’s optimal supply decision?
(b) Assuming the hotel acts as a price taker, what will be the equilibrium price and quantity sold on game days? What about on non-game-days? (Remember, the hotel’s marginal cost is constant!)
(c) Briefly discuss, without solving, how your results in (b) would change if the hotel instead had increasing marginal costs (say for example MC(q) = qrather than MC = 20).
In: Economics
Question 2: AHP
A tourism company want to evaluate four hotels and select the best
one using four criteria project's COST, CLEANNESS and DISTANCE and
SIZE of the HOTEL. Assume that the company prefers; cleanness two
times more than size, cost two times more than distance, and
distance 1.5 times more than size.
|
Criterion |
|
|
|
|
||||
|
Cleanness |
Very good |
|
excellent |
average |
||||
|
Cost ($) |
200 |
175 |
250 |
190 |
||||
|
SIZE of rooms (m2) |
15 |
12 |
20 |
25 |
||||
|
Distance from Downtown (km) |
0 |
4 |
2 |
7 |
1. Calculate the weights of each criteria
2. Generate the pair-wise comparison of hotels based on each
criterion using the scale of Saaty (1-9)
3. Calculate the score of each hotel based on each criterion
4. Calculate the score of each hotel. Justify the best selection
for the company.
5. Calculate CI, and CR. What does the value of CT means?
In: Advanced Math
what are the interior and exterior facilities required to construct an amusement park
details of infrastructure of an amusement park
In: Civil Engineering