# Comparing MultiDimensional Array to single variable array

Page 1 of 1

## 2 Replies - 1708 Views - Last Post: 08 December 2009 - 06:21 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=144177&amp;s=28b4ff0913d46b1c46022391958405a5&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 UTD_JavaSean

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

# Comparing MultiDimensional Array to single variable array

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

Reputation: 2897
• Posts: 11,121
• Joined: 15-July 08

## Re: Comparing MultiDimensional Array to single variable array

Posted 08 December 2009 - 04:43 AM

And please tell us what you need help with in the message body, not the description field. Thank you!

### #3 pbl

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

Reputation: 8362
• Posts: 31,955
• 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"}; ?