GMU Programming Vehicles with Standard & Hybrid Engine Exam Practice

Exercises are:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  • 7.3
  • 7.18 for part b), you may choose any pair of vehicles as long as one has a standard engine and the other is a hybrid. Make sure to label your graph appropriatley, and add a legend. for part d), code the script to use whichever point the user selects, but write your result in the comments of the script file
  • 7.13 ; Specify appropriate labels for each collumn.

nl data in
lable in the
PROBLEMS
-diting win-
in orange
own in red
r.
Input Function
7.1 Prompt the user to enter a value of x and then calculate the value of sin (x).
7.2 Prompt the user to enter a matrix, then use the max function to determine
the largest value entered. Use the following matrix to test your program:
[1, 5, 3, 8, 9, 22]
mmands
7.3 The volume of a cone is
h
1
V=
X area of the base X height.
3
Prompt the user to enter the area of the base and the height of the cone (see
Figure P7.3). Calculate the volume of the cone.
Figure P7.3
Volume of a cone.
Disp Function
7.4 One of the first computer programs many students write is called “Hello,
World.” The only thing the program does is print this message to the com-
puter screen. Write a “Hello, World” program in an M-file, using the disp
function.
7.5 Use two separate input statements to prompt a user to enter his or her first
U point
plam
the electric
(watts). Auto
in ft lb/s. H
measureme
This corresponds to three significant figures (one before and two after
the decimal point).
7.12 Use your favorite Internet search engine and browser to identify recent
currency conversions for British pounds sterling, Japanese yen, and the
European euro to US dollars. Use the conversion tables to create the follow
ing tables (use the disp and fprintf commands in your solution, which
should include a title, column labels, and formatted output):
(a) Generate a table of conversions from yen to dollars. Start the yen column
at 5 and increment by 5 yen. Print 25 lines in the table.
(b) Generate a table of conversions from the euros to dollars. Start the euro
column at 1 euro and increment by 2 euros. Print 30 lines in the table.
(c) Generate a table with four columns. The first should contain dollars, the
second the equivalent number of euros, the third the equivalent number
of pounds, and the fourth the equivalent number of yen. Let the dollar
column vary from 1 to 10.
table
7.13 Consider the patient data contained in table P7.13.
Table P7.13 Patient Data
(a) Gener
at OK
the i
a tal
(b) Rep
(c) Ger
Patient Last Name Patient First Name
Age
Height (inches)
Weight (lb)
sta
Fred
47
er
Smith
Jones
Webb
Anderson
Kathy
Milton
66
6
22
92
45
82
140
110
190
62
72
John
(d) R
(e) G
(a) Create a column vector of last names called last, using curly braces.
(b) Create a column vector of first names called first, using curly braces.
(c) Create column vectors for age, height and weight.
(d) Display the information using the table function.
• of the
Y.TV The gaunpuu-
strate this feature by doing the following
• Create a graph of a circle by defining an array of angles from 0 to 2 , with
a spacing of /100.
• Use the ginput function to pick two points on the circumference
circle.
• Use hold on to keep the figure from refreshing, and plot a line between
the two points you picked.
• Use the data from the points to calculate the length of the line between
them. (Hint: Use the Pythagorean theorem in your calculation.)
7.18 In recent years, the price of gasoline has fluctuated dramatically. Automobile
companies have responded with more fuel-efficient cars, in particular, hybrid
models. But will you save money by purchasing a hybrid such as the Toyota
Camry rather than a Camry with a standard engine? The hybrid vehicles
are considerably more expensive, but get better gas mileage. Consider the
vehicle prices and gas efficiencies shown in Table P7.18.
Table P7.18 A Comparison of Standard and Hybrid Vehicles
Year
Gas Efficiency, in-town/
Model
Base
MSRP highway (mp3)
2016 Toyota Camry
$23,070 25/35
2016 Toyota Camry Hybrid IE
$26,790 43/39 (hybrids may actually get better
mileage in town than on the road)
2016 Toyota Highlander Limited
$40,915 20/25
2016
Toyota Highlander Limited Hybrid $47,870 28/28
2016 Ford Fusion S
$22,120 23/34
2016 Ford Fusion S Hybrid
$25,185 43/41
One way to compare two vehicles is to find the “cost to own.”
Cost to own = Purchase cost + Upkeep + Gasoline cost
Assume for this exercise that the upkeep costs are the same, so in our com-
parison we’ll set them equal to zero.
(a) What do you think the cost of gasoline will be over the next several years?
Prompt the user
enter an estimate of gasoline cost in dollars/gallon.
(b) Find the “cost to own” as a function of the number of miles driven for
a pair of vehicles from the table, based on the fuel price estimate from
Problems 275
V
part (a). Plot your results on an x-ygraph. The point where the two lines
cross is the break-even point.
(c) Use the ginput function to pick the break-even point off the graph.
(d) Use sprintf to create a string identifying the break-even point, and
use the result to create a text-box annotation on your graph. Position the
text box using the gtext function.
Using Sections
7.19 Publish your program and results from Problem 7.17 to HTML, using the
Publish to HTML feature. Unfortunately, because this chapter’s assignment
requires interaction with the user, the published results will include errors.
7.20 Save your homework assignment as a Live Script. Run the file, with the results
displayed on the right-hand-side of the page. You will achieve a better look-
ing and more functional result if you start each problem as a new section.
MOLDOISODIO
lao
STION 12
vibodo

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER