ACTIVITY 1.6

In this activity you will modify the program that walks a list of 
cars, picking out the fastest and slowest cars, so that it uses
Java collections instead of the arrays.

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\1.6. 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.  The code you see is the solution code to the previous
    exercise, 1.5. You will modify it to use methods instead
    of a single monolithic main method.

6.  We are going to extract a method to initialise the cars
    ArrayList first. Just below the 'public class App {' line,
    near the top of the program, add a new method that returns
    an ArrayList as follows:

    static ArrayList<String> getCars() {

    }

7.  Drag the line of code from main() that creates the
    ArrayList<String> cars, and the six cars.add lines
    beneath it into the body of the new function.

8.  Just before the closing brace of the new function,
    add a line that returns the newly initialised
    collection to the caller of the method:

    return cars;

9.  Back in the main() function, insert a new first line
    of code that recreates the list of car names:

    ArrayList<String> cars = getCars();

10. Save your file, compile and run to make sure the
    program still give the correct results.

11. Repeat steps 6 to 10 to extract a method called
    getTopSpeeds() to initialise the topSpeeds collection.

12. Repeat steps 6 to 10 again to initialise the
    Map<String, Integer> carMap collection found lower
    down the main function.

IF YOU HAVE TIME ...

13. Add an empty method that displays the fastest and slowest
    car names. It should look like this:

    static void OutputFastestAndSlowest(String fastest, String slowest) {

    }

14. Fill in the method with one of the two pairs of
    lines from main() containing System.out.println. Note that
    you will have to modify the lines to use the arguments
    'fastest' and 'slowest' instead of the code they currently
    contain:

    System.out.println("The fastest car is the " + fastest);
    System.out.println("The slowest car is the " + slowest);

15. Modify the code in main() in both places where the
    fastest and slowest cars are reported so that they called
    your new method instead.

16. Save, compile and run your file to make sure it still gives
    the correct output.

YOU HAVE FINISHED!