ACTIVITY 2.1

In this activity, you will create a Java class, then 
use it to create and manipulate objects of that class.
The class you will be creating describes motor vehicles.

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.1. 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 'App.java' file to
	open it.

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

5.  We are going to create an additional class, as well as the
    existing App.java class. Select File | New file... from 
    the main menu of Visual Studio Code.

6.  A new file is created with a single line of text at the top.
    Click on 'Select a language' in the text, and from the drop-down
    list that appears, scroll down and select Java.

7.  From the main menu, select File | Save as... and in the dialog
    that appears. DOuble click 'src' in the larger panel to select the
    src folder, then change the file name to Vehicle.java, before
    clicking the Save button.

8.  An empty Java class called Vehicle will automatically appear,
    along with a drop-down highlighting 'class Vehicle'. Click on
    'class Vehicle' in the drop-down to confirm you want this
    file to contain that class.

9.  In the body of the class, on the blank line between the opening
    and closing curly braces, type a declaration for a variable
    named 'make' that is of type String:

        private String make;

10. Because it is private, we need to make it accessible from
    outside the class via two methods. One to get its value, the
    other to set its value. Add the following two methods beneath
    your variable declaration:

        public String GetMake() {
            return make;
        }

        public void SetMake(String make) {
            this.make = make;
        }

11. Now repeat steps 9 and 10 for the following items:
    * A variable of type int with the name topSpeed
    * A variable of type double with the name zeroToSixty
    * A variable of type double with the name milesPerGallon

12. Now you will add one method that works out statistics for
    a journey. Add the following method beneath the other methods
    (Use copy and paste as it's quicker in this case):

    public String CalculateJourney(double miles) {
        double timeTaken = miles / topSpeed;
        double fuelUsed = miles / milesPerGallon;
        return "The " + make + " can travel "
            + miles + " miles in " + timeTaken * 60
            + " minutes, and uses " + fuelUsed + " gallons.";
    }

13. Now find the App.java file and open it. You are going to create
    a vehicle, and use its methods.

14. In the body of the empty main() function, create an instance
    of a vehicle:

    Vehicle myCar = new Vehicle();

15. Now fill in you car's make, top speed, fuel consumption
    and zero to sixty acceleration with the details for your own car.
    An example follows:

    myCar.SetMake("VW Golf");
    myCar.SetTopSpeed(120);
    myCar.SetZeroToSixty(7.5);
    myCar.SetMilesPerGallon(56);

16. Now add some lines at the bottom of your main function that
    call some of the other methods of your vehicle:

    System.out.println("My car is a " + myCar.GetMake());
    System.out.println(myCar.CalculateJourney(30));

17. Run your program and see if you agree with the output. To
	do this, save all files, then launch a new terminal. Change
	directory to the src folder, then compile all java files
	using the command: javac *.java. You will still run the
	program by typing java App 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!