Comparing MultiDimensional Array to single variable array

I am trying to compare a String array to a int[][]number array

Page 1 of 1

2 Replies - 1644 Views - Last Post: 08 December 2009 - 06:21 PM Rate Topic: -----

#1 UTD_JavaSean  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-December 09

Comparing MultiDimensional Array to single variable array

Post icon  Posted 08 December 2009 - 02:14 AM

//Program created by John F. $#33#^(\)

import java.util.Scanner;
import java.text.DecimalFormat;

public class Lab11_Ex1
{
public static void main(String[]args)
{
final int SALES=4;
final int QTR=4;
final int NAME=3;
final int PERS=3;
double totalSales=0.0;

Scanner keyboard=new Scanner(System.in);
DecimalFormat formatter=new DecimalFormat("0.00");

String[]Names=new String[NAME];
int[][][]Sales=new int[PERS][QTR][SALES];

System.out.println("This program will take 3 Names,");
System.out.println("and their sales for each quarter,");
System.out.println("and print the total sales with their name.");
System.out.println("Please enter all requested data accurately.");

for(int name=0;name<NAME;name++)
{
System.out.println("Associate "+(name+1)+" name: ");
Names[name]=keyboard.nextLine();
}

for(int index=0;index<PERS;index++)
{
for(int sale=0;sale<SALES;sale++)
{
for(int qtr=0;qtr<QTR;qtr++)
{
System.out.println("Enter person "+(index+1)+"'s");
System.out.println("Quarter "+(qtr+1)+" sales: ");
Sales[index][qtr][sale]=keyboard.nextInt();
}
}
}
System.exit(0);
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: Comparing MultiDimensional Array to single variable array

#2 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2876
  • View blog
  • Posts: 11,050
  • Joined: 15-July 08

Re: Comparing MultiDimensional Array to single variable array

Posted 08 December 2009 - 04:43 AM

:code:

And please tell us what you need help with in the message body, not the description field. Thank you!
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Comparing MultiDimensional Array to single variable array

Posted 08 December 2009 - 06:21 PM

Comparing a String[] array to an int[][] array
What would be your comparaison criteria:

What would be the int[][] array equals to
String[] fruit = {"Apple", "Banana", "Orange", "Grape"}; ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1