The EcoMarathon is an annual competition sponsored by Shell
The Eco-Marathon is an annual competition sponsored by Shell Oil, in which participants build special vehicles to achieve the highest possible fuel efficiency. The Eco-Marathon is held around the world with events in the United Kingdom, Finland, France, Holland, Japan, and the United States.
A world record was set in the Eco-Marathon by a French team in 2003 called
Microjoule with a performance of 10,705 miles per gallon. The Microjoule runs on ethanol. Write a MATLAB program to determine how far the Microjoule will travel in kilometers given a user-specified amount of ethanol, provided in units of grams. your program should ask for the mass using an input statement and display the distance in formatted sentence similar to the output shown below.
output:
Enter mass of ethanol [grams] : 100
The distance the Microjoule traveled is 577 kilometers.
Solution
% matlab code to determine how far the Microjoule will travel in kilometers given a user-specified amount of ethanol
mass = input(\"Enter mass of ethanol [grams]: \");
mass = mass / 0.789;
ounce = mass* 0.033814;
gallon = ounce*0.0078125;
% given, 10705 miles/gallon
distance = 10705*gallon;
distance_km = distance*1.60934;
fprintf(\"The distance the Microjoule traveled is %f kilometers\ \",distance_km);
%{
output:
Enter mass of ethanol [grams]: 100
The distance the Microjoule traveled is 576.824971 kilometers
%}
