View the step-by-step solution to:

This java give error message when i compile the file: Please can someone help me out on this?

This java give error message when i compile the file:

Please can someone help me out on this?

//Import Utilities

import java.util.Scanner;

import.java.io;


public class USCrimeFile {

public static USCrime[]read(String filename) {

//Array Declaration

USCrime[] stats = new USCrime(20);

//Varieable Declaration

int count = 0;

String line;


//Read File

try {

Scanner inputReader;

inputReader = new Scanner(new File(filename));

inputReader.nextLine();

while(inputReaderhasNext()) {

line = inputReadernextLine();

String[] date = line.split(",");

stats[count] = new USCrime(Integer.parseInt(data[0])); //USCrime Year from file

stats[count].setPopulation(Integer.parseInt(data[1])); // US Population from file

stats[count].setMurderRate(Float.parseFloat(data[5])); // US Crime Murder Rate from file

stats[count].setRobberyRate(Float.parseFloat(data[9])); // US Crime Robbery Rate from file

stats[count].setBurglaryRate(Float.parseFloat(data[15])); // US Crime Burglary Rate from file

stats[count].setRapeRate(Float.parseFloat(data[7])); // US Crime Rape rate from file

count++;

}

inputReaderclose();

catch(FileNotFoundException e) {

System.out.println();

System.out.println(e);

System.out.print("n1.Please ensure the file name is correct.");

System.out.println("2.Please ensure the file resides in the same location as the java application.");

System.out.println("3.Please re-run application.");

System.exit(0);

}

return stats;

}

}


public class USCrime {

//Declare Variables

private float mRate;

private float rRate;

private int pCrime;

private int population;

private int year;

private float bRate;

private float rpRate;

//Constructor

public USCrime(int year) {

this.year = year;

}

//Getters

public float getMurderRate() {

return mRate;

}

public float getRobberyRate() {

return rRate;

}

public int getYear() {

return year;

}

public float getBurglaryRate() {

return bRate;

}

public float getRapeRate() {

}

//Setters

public voic setMurderRate(float mRate) {

this.mRate = mRate;

}

public void setRobberyRate(sloatrRate) {

this.rRate = rRate;

}

public void setBurglaryRate(floatbRate) {

this.bRate = bRate;

}

public void setRapeRate(float rpRate) {

this.rpRate = rpRate;

}

}


public class USCrimeMenu {

public static String getUSCrimeMenu() {

//instantiate and read menu into string variable

String menu "" *n" + "Select question number. Enter 'Q' to quit the program:n" + "1. What were the percentages in population growth for each consecutive year from 1994 = 2013?n" +

"2. What year was the Murder rate the highest?n" +

"3. What year was the Murder rate the lowest?n" +

"4. What year was the Robeery rate the highest?n" +

"5. What year was the Robeery rate the lowest?n" +

"6. Which year was the Burglary rate the highest and lowest?n" +

"7. Which year was the Rape rate the highest and lowest?n" +

"8. Which year was the Population in a particular year?n" +

"Q. Quit the programn" +

"Enter your selection:";

return menu;

}

}


public class USCrimeMethods {

//Highest Murder Rate Method

public static int maxMurRteYr(USCrime[] data) {

int year = 0;

float maxrte = 0;

for(USCrime crime:data) {

if(crime.getMurderRate() >maxRte) {

maxRte = crime.getMurderRate();

year = crime.getYear();

}

}

return year;

}

public static float maxMurte(USCrime[] data) {

int year = 0;

float maxRte = 0;

for(USCrime crime:data) {

if(crime.getMurRate() >maxRte) {

maxRte = crime.getMurderRate();

year = crime.getYear();

}

}

return maxRte:

}

//Lowest Murder rate Method

public static int minMurRteYr(USCrime[] data) {

int year = 0;

float minRte = data[0].getMurderRate();

for(crime.getMurderRate()<minRte) {

minRte = crime.getMurderRate();

year = crime.getYear();

}

}

return year;

}

public static float minMurRte(USCrime[] data) {

int year = 0;

float minRte = data[0].getMurderRate();

for(USCrime crime:data) {

if(crime.getMurderRate() <minRte) {

for(crime.getMurderRate() < minRte) {

minRte = crime.getMurderRate();

year = crime.getYear();

}

}

return minRte;

}


//Highest Robbery Rate Method

public static int maxRobRteYr(USCrime[] data) {

int year = 0;

float maxRte1 = 0;

for(USCrime crime:data) {

if(crime.getRobberyRate() >maxRte) {

maxRte1 = crime.getRobberyRate();

year = crime.getYear();

}

}

return year;

}

public static float maxRobRte(USCrime[] data) {

int year = 0;

float maxRte1 = 0;

for(USCrime crime:data) {

if(Crime.getRobberyRate() >maxRte1) {

maxRte1 = crime.getRobberyRate();

year = crime.getYear();

}

}

return maxRte1;

}

//Lowest Robbery Rate Method

public static int mintRobRteYr(USCrime[] data) {

int year = 0;

float minRte1 = data[0].getRobberyRate();

for(UScrime crime: data) {

if(crime.getRobberyRate() < minRte) {

minRte1 = crime.getRobberyRate();

year = crime.getYear();

}

}

return year;

}

public static float minRobRte(USCrime[] data) {

int year = 0;

float minRte1 = data[0].getRobberyRate();

for(USCrime crime:data) {

if(crime.getRobberyRate() <minRte1) {

minRte1 = crime.getRobberyRate();

year = crime.getYear();

}

}

return minRte1;

}

//Highest Burglary rate Methode

public static int maxBurRteYr(USCrime[] data) {

int year = 0;

float maxRte2 = 0;

for(USCrime crime:data) {

if(crime.getBurglaryRate() >maxRte2) {

maxRte2 = crime.gerBurglaryRate();

year = crime.getYear();

}

}

return year;

}

public static float maxBurRte(USCrime[] data) {

int year = 0;

float maxRte2 = 0;

for(USCrime crime:data) {

if(crime.getBurglaryRate() >maxRte2) {

maxRte2 = crime.getBurglaryrate();

year = crime.getYear();

}

}

return maxRte2;

}

//Lowest Robbery rate Method

public static int minBurRteYr(USCrime[] data) {

int year = 0;

float minRte2 = data[0].getBurglaryRate();

for(UScrime crime:data) {

if(crime.getBurglaryrate() <minRte2) {

minRte2 = crime.getBurglaryRate();

minRte2 = crime.getBurglaryrate();

year = crime.getYear();

}

}

return year;

}

public static float minBurRte(USCrime[] data) {

int year = 0;

float minRte2 = 0;

for(USCrime crime:data) {

if(crime.getBurglaryRate() >minRte2) {

maxRte2 = crime.getBurglaryrate();

year = crime.getYear();

}

}

return minRte2;

}


//Highest rape rate Method

public static int maxRapRte(USCrime[] data) {

int year = 0;

float maxRte3 = 0;

for(USCrime crime:data) {

if(crime.getRapeRate() >maxRte2) {

maxRte3 = crime.getRaperate();

year = crime.getYear();

}

}

return year;

}

public static float maxRapRte(USCrime[] data) {

int year = 0;

float maxRte3 = 0;

for(USCrime crime:data) {

if(crime.getRapeRate() >maxRte3) {

maxRte3 = crime.getRaperate();

year = crime.getYear();

}

}

return maxRte3;

}


//Lowest Rape Rate Method

public static int minRapRte(USCrime[] data) {

int year = 0;

float maxRte3 = data[0].getRapeRate90;

for(USCrime crime:data) {

if(crime.getRapeRate() >minRte3) {

maxRte3 = crime.getRaperate();

year = crime.getYear();

}

}

return year;

}


public static float minRapRte(USCrime[] data) {

int year = 0;

float maxRte3 = data[0].getRapeRate();

for(USCrime crime:data) {

if(crime.getRapeRate() >maxRte3) {

maxRte3 = crime.getRaperate();

year = crime.getYear();

}

}

return maxRte3;

}


//Population Growth rate Method

static void disPopPct(USCrime[] data) {

float growRte;

System.out.println("Population Growth year to Year");

System.out.println("****************");

for(int i = 0; i < data.length =1:i++) {

growRte = 100*(float)(data[i + 1].getPopulation() = data[i].getPopulation())/ data[i].getPopulation();

System.out.println("From" + data[i].getYear() + " to " + data[i + 1].getYear() + " the

 population growth was"

    +String.format("%.4f",growRte) + "%");


}

}

}

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question