/**
 * CS139 - Programming Fundamentals
 * Department of Computer Science
 * James Madison University
 * @version Spring 2016
 */

Introduction

The goal for this activity is to implement a Car class so that it conforms to the UML below:

Part 1: Driver, Constructor and toString

  1. Create two Java class files: CarTester.java and Car.java. Only CarTester.java should include a main method.
  2. Add the three instance variables from the UML diagram to your Car class.
  3. Code the constructor for your Car class. This should intialize the make and year fields using the arguments to the constructor. The speed should be initialized to 0.
  4. Code the toString method. This method should take no parameters and should return a string generated using the String.format method:

    String.format("A %d %s that is going %.1f mph", year, make, speed)
  5. Test your partially completed Car class by adding code to the main in CarTester.java that creates and prints two car objects. The contents of main should look something like the following.
    Car car1;
    Car car2;
    
    car1 = new Car("Ford", 1997);
    car2 = new Car("Toyota", 2014); 
    
    System.out.println(car1.toString());
    System.out.println(car2.toString());
    
    

Part 2: Remaining Methods

Complete each of the remaining methods of the Car class. Test each method by adding appropriate calls to main.

Zip Car.java and CarTester.java and submit them through Web-CAT. Web-CAT will not run Checkstyle tests on your submission.

Part 3: JGrasp Viewer Canvas

Use the "viewer canvas" feature of JGrasp to run your main method interactively: Instead of clicking on the run button, click on run
canvas. This should allow you to step through your main one instruction at a time. You should be able to inspect the contents of your variables by dragging them from the "Variables" tab into the viewer canvas window.