JMU
logoDukeDash.png
Going Further on Programming Assignment 4


These questions/problems/tasks allow you to go further on Programming Assignment 4. They are neither required nor for extra credit. They will, however, help you gain a deeper understanding of the material.
1 Overview: To this point, you have written several applications -- SpeedSetter, TripSetter, DetailedTripSetter, and DetailedSpeedSetter. For this assignment you must combine them into one application called DashboardSetter. It must be possible to start this application with between 1 and 4 command-line arguments.
2 Operation: If the application is passed one argument it will be the current speed in mi/hr and it must use the default speed limit.

If the application is passed two arguments the first will be the current speed and there are two possibilities for the second.

If the second argument is a number it is the speed limit in km/hr.

If the second argument is not a number then the application must ignore the speed limit (i.e., not check to see if it is being exceeded).

If the application is passed three arguments the first contains the current speed in mi/hr, the second contains the trip distance in ft, and the third contains the trip duration in hr. The application must ignore the speed limit.

If the application is passed four arguments the first contains the current speed in mi/hr, the second contains the trip distance in ft, and the third contains the trip duration in hr. There are two possibilities for the fourth argument.

If the fourth argument is a number it is the speed limit in km/hr.

If the fourth argument is not a number then the application must ignore the speed limit (i.e., not check to see if it is being exceeded).

3 Things to Consider: Remember that the methods in the Text class for converting String objects to numbers return a special value if the String can't be converted.

Also remember, elegance matters. To make your implementation elegant, you may need to add functions to your classes.

Copyright 2013