So, as before, DukeDash will be given the current speed in mi/hr, convert it to km/hr, and display the speed in km/hr. Also as before, DukeDash will be given the distance traveled during the current trip in ft and the duration of the current trip in hr and it must calculate and display the average trip speed in both mi/hr and km/hr. Now, in addition, it must calculate and display the distance traveled during the current trip in both km and mi,ft (i.e., whole miles and remaining feet).
a. An exercise that should help you understand the problem and how to solve it. (Note: You may only attempt this part of the assignment once. Hence, it is only required that you attempt this part before starting the next part. However, if you do not earn a grade of 100% on this part you should make sure you understand all of the correct answers before starting the next part.)
b1. A textual version of an algorithm for converting a distance in ft to a distance in mi,ft (i.e., whole miles and remaining ft), and a textual version of an algorithm for converting a distance in mi to a distance in km. (Note: You need not submit anything for this part of the assignment. However, as you did in the previous assignments, you should create a textual version of an algorithm on paper before you start typing.)
b2. A textual version of an algorithm for converting a String
representation of a distance in
ft to a distance in mi,ft (i.e., whole miles and remaining ft)
and to a distance in km. This algorithm should use the algorithms
from Part b1.
(Note: You need not submit anything for this part of the assignment.
However, as you did in the previous assignments, you should create
a textual version of an algorithm on paper before you start typing.)
b.3. A modified version of your Java class named Converter
that now has the ability to convert distances measured in miles to
distances measured in kilometers, and to convert distances
measure in whole feet to
equivalent distances measured in whole miles and
remaining feet.
b.4. A Java main class that is: given command-line strings containing a real-valued speed in mi/hr, an integer-valued trip distance in ft, and a trip duration in hr; converts the strings as appropriate; performs the necessary calculations; and displays the results.
pa3
) that
will hold all of the files for this assignment.
Next, you should copy your Converter.java
and the provided
Text.class
and Dashboard.class
to the directory
you just created.
Next, you should copy your TripSetter
class to the directory
you just created, rename it to DetailedTripSetter
,
edit DetailedTripSetter.java
and change the name of the
class from TripSetter
to DetailedTripSetter
.
Converter
class and your
TripSetter
class independently.
toKilometers()
,
toWholeMiles()
and toRemainingFeet()
functions to the Converter
class.
toWholeMiles()
and
toRemainingFeet()
functions you may use the following
programs:
You should read and understand these programs before using them.
You may also need to write other drivers for testing the
Converter
class.
Converter.toMiles()
function, you should perform regression testing to make sure
you didn't break anything that was already working.
You can use the drivers from the previous programming assignment
for this purpose.
Converter
class, you should use the textual algorithm from Part b2
and the algorithm/code in the TripSetter
class to
implement the DetailedTripSetter
class.
PA3TestSuite.jar
(in the same way you used PA2TestSuite.jar
for the previous
assignment). Before doing so, you will need to copy
junit.jar
to your
working directory for this assignment.
Copyright 2013