Java-City-of-Mississauga-Sewer-Assets / Mississauga Sewer Analysis GH / SewerAnalysis / Main.java
Main.java
Raw
package SewerAnalysis;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Main class to launch sewer analysis
 */
public class Main {

    /**
     * Main method to drive program and output analysis
     */
    public static void main(String[] args) throws IOException {
        Scanner input = new Scanner(System.in);
        System.out.println("Type the dataset size slice to analyze between an integer of 0 and 82,036 (82,036 being the size of the entire dataset):");

        int nLines = Integer.parseInt(input.nextLine());

        MississaugaSewers ms = new MississaugaSewers(nLines);
        System.out.println("Type the name of a works yard you'd like to know how many sewer assets reside in (ie Mavis, Clarkson, Malton, Meadowvale):");

        String worksYard = input.nextLine().toUpperCase();

        System.out.println("Type an existing ward number of the works yard you'd like to know how many sewer assets reside in (an integer between 1 and 11):");

        short ward = Short.parseShort(input.nextLine());

        ArrayList<Sewer> fwwy = ms.filterWardWorksYard(worksYard, ward);
        System.out.println("Number of sewer assets in given works yard and ward: " + fwwy.size());
        System.out.println("Type the asset ID of an existing sewer asset in the dataset range to view its asset type (ranges anywhere from 0 to over 2,000,000):");

        long assetID = Long.parseLong(input.nextLine());

        Sewer sewer1 = ms.fetchSewer(assetID);
        System.out.println("Sewer's asset type: " + sewer1.assetType);
        System.out.println("Type the asset ID of another existing sewer asset in the dataset range for asset type view (ranges anywhere from 0 to over 2,000,000):");

        long assetID2 = Long.parseLong(input.nextLine());

        Sewer sewer2 = ms.fetchSewer(assetID2);
        System.out.println("Sewer's asset type: " + sewer2.assetType);
        System.out.println("\nThe Haversine distance between both sewer assets (in metres): " + sewer1.distanceTo(sewer2));
    }
}