So that you don't inadvertently break something that is working,
copy the file named SpeedSetter.java
to a file named
DashSetter.java
, edit DashSetter.java
, and
change the class name from SpeedSetter
to
DashSetter
.
Now, modify DashSetter.java
so that it also calculates
and prints the number of times that the tire (or wheel)
rotates each minute, assuming that the diameter of each wheel
is 27in.
Hint: You need to calculate the circumference of the tire in inches, convert that to miles, and then calculate the rotations per minute. (Be careful about units!)
Dashboard
class has the ability to display a tachometer
as well as a speedometer. To use it, you must call the
setRPM(double rpm)
function in the Dashboard
class.
Modify your DashSetter
class so that it displays both
the speed and the RPM on the Dashboard
.
Copyright 2013