DetailedSpeedSetter
main class is given a current
speed measured in mi/hr and an optional speed limit in km/hr,
informs the dashboard if the vehicle is exceeding the speed limit,
and displays the equivalent current speed in km/hr.
The
Text
class contains functions that can be used
to convert from a String
to a number.
The
Dashboard
class contains a function that can be used
to display the current speed. It also contains a function
named setSpeeding()
that is passed a boolean
indicating whether or not the Dashboard
should
inform the driver that she/he is exceeding the speed limit.
The system must satisfy the following physical requirements:
PR-1
The main class must be named DetailedSpeedSetter
PR-2 The main class must include a correct implementation of the following function:
/** * Determines whether the given speed exceeds the given limit * * @param speed The speed in km/hr * @param limit The speed limit in km/hr * @return true if speed exceeds limit and false otherwise */ public static boolean isSpeeding(double speed, double limit) { }
The system must satisfy the following operational requirements:
OR-1
Command-line argument 0 must contain a String
representation of the current speed in mi/hr.
OR-2
Command-line argument 1, if it exists, must contain a String
representation of the speed limit in km/hr.
OR-3 If there is only one command-line argument, the system must use the default speed limit of 40.0 km/hr.
OR-4 If the user-provided speed limit in km/hr is smaller than the smallest allowable speed limit (which is 20 km/hr), the system must use the smallest allowable speed limit.
OR-5
The main class must use the Converter
class
for all conversions of units.
OR-6
The main class must determine whether the current speed exceeds
the speed limit using the isSpeeding()
function
described above.
OR-7
The main class must call the setSpeeding()
function
in the Dashboard
class to indicate whether or not
the Dashboard
should inform the driver that she/he
is exceeding the speed limit.
OR-8
The main class must pass the setSpeed()
function
in the Dashboard
class the current speed
in km/hr.
Copyright 2013