Part of a program I did.
I don't understand why it doesn't work.
import java.util.Scanner;
public class Reports {
public static void main(String args[])
{
int[][] sales = new int[6][4];
String [] company = {"Dallas","Chicago","Boston","New York","Seattle","Washington"};
EnterData(sales,company);
Highest(sales,company);
}
public static void EnterData(int sales[][],String company[])
{
Scanner input = new Scanner(System.in);
for(int i = 0; i < 6; i++){
System.out.println("\nEnter The Quarterly Sales For " + company[i]+ "\n");
for(int j = 0; j<4; j++)
{
System.out.print("Enter The Sales For Quarter " + (1+j)+ ": ");
sales[i][j]= input.nextInt();
while(sales[i][j]<0)
{
System.out.print("Enter The Sales For Quarter " + (1+j)+ ": ");
sales[i][j]= input.nextInt();
}
}
public static void Highest(int sales[][],String company[])
{
int value;
int highest = 0;
int i;
int j;
for(i = 0; i<4;i++){
value = 0;
highest = 0;
for( j = 0 ;j<6;j++)
if(value < sales[j][i])
highest = j;
System.out.println(highest);
System.out.println("The Comapny With Highest Sales In The "+ (i+ 1) + " Quarter is " + company[highest] + "\n");
}
}