ACTIVITY 2.2

In this activity, you will edit your Java vehicle class
so that it uses constructors to initialise its internal data.

1. 	As before, open Visual Studio Code by double-clicking its
	icon on the desktop, or by selecting it from the application
	menu.
	
2.	Your instructor will have given you the path to a folder
	containing the course exercises. It will be something like
	Documents\Course\2.2. From the main menu bar, select
	File | Open folder... then in the folder search dialog
	that appears, navigate to the folder your instructor
	gave you. Click 'Select folder' to open the folder.

3.	In the Explorer bar at the left of the screen, Click
	the 'src' folder, then click the 'Vehicle.java' file to
	open it.

4.	Make sure the Vehicle.java tab is selected at the top of the
	window, if you get a Java overview window hiding Vehicle.java.

5.  We are going to edit the Vehicle class to give it a constructor.
    Add an empty constructor at the top of the body of the
    Vehicle class:

        public Vehicle(String make, int topSpeed, 
                    double zeroToSixty, double milesPerGallon) {

        }

6.  In the body of the constructor, assign the values passed
    in as parameters to the data fields with the same names:

        this.make = make;
        this.topSpeed = topSpeed;
        this.zeroToSixty = zeroToSixty;
        this.miles{erGallon = milesPerGallon;
    }

7.  Delete the four methods whose names start with Set. We don't need
    these any more, because we set their values when constructing
    a vehicle.

8.  Launch a terminal window and change directory to the src directory.

9.  Try compiling the program. What happens?

10. We need to edit the App.java code so that it uses the
    constructor we wrote, instead of the now non-existent zero-
    argument constructor.

    Change the lines containing 'new Vehicle' so that the
    values for the four data members are passed in the round
    parentheses that follow 'new Vehicle. Remember to comma-
    separate them.

11. Delete each line that invokes a Set???() method.

12. Recompile your program to see if it now compiles without
    errors. If it does, you should be able to run it and see
    the same output as before.

IF YOU HAVE TIME ...

18. Create a second car, and fill in each of its data items.

19. Compare the two cars and output a message saying which car
    is the fastest.

YOU HAVE FINISHED!