Quelle est la ville 94609
javac USCrimeTest.java
Confused Cowfish
javac USCrimeTest.java
import java.util.Date;import java.util.Scanner;public class USCrimeTest { private Scanner scanner = new Scanner(System.in); private void printWelcomeMessage() { print("-- Welcome to the US USCrime Statistical Application --"); } private void showOptions() { print("1. What were the percentages in population growth for each consecutive year from 1994 ? 2013?"); print("2. What year was the Murder rate the highest?"); print("3. What year was the Murder rate the lowest?"); print("4. What year was the Robbery rate the highest?"); print("5. What year was the Robbery rate the lowest?"); print("6. What was the total percentage change in Motor Vehicle Theft between 1998 and 2012?"); print("7. What was the total percentage change in aggravated assault between 1995 and 2011?"); print("8. What was the total percentage change in Property crime between 1995 and 2009?"); print("Q. Quit the program"); } private void print(String message) { System.out.println(message); } private void showMenu(CrimeParser stats) { Statistics statistics = new StatisticsImpl(stats.getCrimesData()); // Continue displaying the menu as long as the user has not entered "Q" showOptions(); print(""); System.out.print("Enter your selection: "); String selection = scanner.nextLine().trim(); switch (selection) { case "1": statistics.calculatePopulationGrowth(1994, 2013); showMenu(stats); break; case "2": print(statistics.calculateMaxMurderYear()); showMenu(stats); break; case "3": print(statistics.calculateMinMurderYear()); showMenu(stats); break; case "4": print(statistics.calculateMaxRobberyYear()); showMenu(stats); break; case "5": print(statistics.calculateMinRobberyYear()); showMenu(stats); break; case "6": print(statistics.calculateMotorVehicleTheftChange(1998, 2012)); showMenu(stats); break; case "7": print(statistics.calculateAggravatedAssaultChange(1995, 2011)); showMenu(stats); break; case "8": print(statistics.calculatePropertyChange(1995, 2009)); showMenu(stats); break; case "Q": break; default: print("You entered a bad choice. Please try again!"); showMenu(stats); } } public static void main(String[] args) { CrimeParser crimeParser = new CrimeParser(args[0]); USCrimeTest test = new USCrimeTest(); test.printWelcomeMessage(); long start = System.currentTimeMillis(); test.showMenu(crimeParser); long end = System.currentTimeMillis(); long duration = new Date(end - start).getSeconds(); System.out.println("Thank you for trying the US Crimes Statistics Program."); System.out.format("Elapsed time in seconds was: %d%n", duration); }}
java USCrimeTest Crime.csv