JMU
logoDukeDash.png
Programming Assignment 3


1 Overview: President Alger continues to be pleased with your work on DukeDash and wants you to extend the prototype. In particular, he now wants you to add the ability to display trip distances.

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

2 Parts: This assignment is divided into two parts, each of which will be graded individually. You must complete both parts of this assignment in order. The second part is based on the first part and you may (indeed, should) use your answers to the first part to complete the second part.

a. An exercise that should help you understand the problem and how to solve it. Click here to go to Blackboard. (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. Click here for the requirements.

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. Click here for the requirements.

3 Getting Started with the Programming: Before doing anything else, you should create a directory/folder (e.g., named 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.

4 Recommended Process for the Programming: It is strongly recommended that you develop and test your Converter class and your TripSetter class independently.


4.1 Modifying the Converter Class
You should add the toKilometers(), toWholeMiles() and toRemainingFeet() functions to the Converter class.


4.2 Testing the New Functions in the Converter Class
To facilitate the testing of the 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.


4.3 Regression Testing of the Converter Class
When you are done testing the 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.


4.4 Developing the DetailedTripSetter Class
After completing all of the testing of the Converter class, you should use the textual algorithm from Part b2 and the algorithm/code in the TripSetter class to implement the DetailedTripSetter class.


4.5 Testing the DetailedTripSetter Class
In order to reduce the burden on the Web-CAT server, you should test your code off-line before using Web-CAT. To facilitate that process, you should use 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.
Going Further


Copyright 2013