JMU
logoDukeDashWithTach.png
Going Further on Programming Assignment 1


These questions/problems/tasks allow you to go further on Programming Assignment 1. They are neither required nor for extra credit. They will, however, help you gain a deeper understanding of the material.
1 Calculating Tire (or Wheel) Rotations Per Minute: Given the speed in mi/hr and the wheel diameter in inches it is possible to calculate the number of times that the tire (or wheel) rotates each minute.

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!)

2 Displaying Tire (or Wheel) Rotations Per Minute: Though it was not used in Programming Assignment 1, the 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