Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.
Getting Ready: Before going any further, you should:
SpeedPrinter.java.
    public static final double MILES_PER_KILOMETER = 0.621371;
    declares and initializes a:String
double
double
kph is a:String
double
double
toNonnegativeDouble() is a:String
double
double
/ is a:String
double
SpeedPrinter 
    class?SpeedPrinter class?SpeedPrinter class?main() 
    function?main() function?main() function?SpeedPrinter.java.
    SpeedPrinter with a single command line argument
    of 100.0
    SpeedPrinter.java 
    before you can execute it again?SpeedPrinter with two command line arguments,
    60.0 and 70.0
    main() method so that it 
    contains the following code:
    
       double         kph;
       double         mph;
       mph = Text.toNonnegativeDouble(args[0]);
       kph = mph / MILES_PER_KILOMETER;       
       System.out.println(kph);       
       mph = Text.toNonnegativeDouble(args[1]);
       kph = mph / MILES_PER_KILOMETER;       
       System.out.println(kph);       
    
SpeedPrinter.java.
    SpeedPrinter.java 
    (even though you compiled it earlier)?.class file is now out of dateSpeedPrinter.java.
    SpeedPrinter with two command line arguments,
    60.0 and 70.0
    SpeedPrinter.java?SpeedPrinter class
    (in an appropriate spot):
    
    /**
     * A function for converting a speed in mi/hr to
     * a speed in km/hr and printing the result
     *
     * @param   text   A String representation of the speed in mi/hr
     */
    public static void printKPH(String text)
    {
       double         kph;
       double         mph;
       
       mph = Text.toNonnegativeDouble(text);
       kph = mph / MILES_PER_KILOMETER;       
       System.out.println(kph);
    }
    
printKPH() declared to be void?printKPH()?String
double valuemain(), replace the body of the
    main() method with the following:
    
       SpeedPrinter.printKPH(args[0]);
       SpeedPrinter.printKPH(args[1]);
    
SpeedPrinter.java.
    SpeedPrinter with two command line arguments,
    60.0 and 70.0
    printKPH(). That is, change those two lines to the following:
    
       printKPH(args[0]);
       printKPH(args[1]);
    
SpeedPrinter.java. Note that there are no errors.
    SpeedPrinter class, trace the execution
    when it is run with a single command-line argument.
public class SpeedPrinter
{
    static final double MILES_PER_KILOMETER = 0.621371;
    
    public static void printKPH(String text)     // 1
    {
       double         kph;
       double         mph;
       
       mph = Text.toNonnegativeDouble(text);     // 2
       kph = mph / MILES_PER_KILOMETER;          // 3
       System.out.println(kph);                  // 4
    }
    public static void main(String[] args)       // 5
    {
       printKPH(args[0]);                        // 6
       printKPH(args[1]);                        // 7
    }
}
    Specifically, list (the numbers of) all of the statements as they
    will be executed. (Hint: The main() function is
    called the entry-point.)
    
SpeedSetter.java
toKPH() declared to be a double?double valuedouble valuetoKPH() in main()
    does not include the class name.
    SpeedSetter 
    compile without errors in spite of this?toKPH() is in the same class 
             as main()
toKPH() has a descriptive nametoKPH() doesn't do anythingSpeedSetter.java
Converter.java that contains the
    following:
    
/**
 * A utility class that can be used to convert values of
 * various kinds
 */
public class Converter
{
}
    
SpeedSetter.java and paste it in the first blank line
    in the Converter class.
    toKPH() (and its comments) in
    SpeedSetter.java and paste it in the last blank line
    in the Converter class.
    Converter.java (It should compile without errors.)
    SpeedSetter.java
SpeedSetter.java, change the call to toKPH()
    to the following:
    
       kph = Converter.toKPH(mph);       
    
SpeedSetter.java (It should now compile without 
    any errors.)
    Dashboard class contains a function named
    setSpeed() that is passed a double containing
    a speed in km/hr and displays it on a speedometer.
    SpeedSetter.java so that, instead of
    printing the value in kph it passes it to the
    setSpeed() function in the Dashboard
    class.
    SpeedSetter.java (It should compile without any
    errors.)
    SpeedPrinter with a single command line argument
    of 60.0
    Converter class in between
    the } that ends the method toKPH() and
    the } that ends the class.
    
    /**
     * Multiply a speed by 2
     */
    public static double double(double mph)
    {
       return 2.0 * mph;   
    }
    
Converter.java
twice() (i.e., change the
    second double to twice).
    Converter.java (It should compile without errors.)
    twice()
    function. In other words, your code should now look like:
    
    public static double twice(double mph);
    {
       return 2.0 * mph;   
    }
    
Converter.java
twice() to below the 
    last }.
    Converter.java
twice().
    Converter.java (It should compile without errors.)
    Copyright 2013