Steve
Posts: 5
Nickname: srbeckle
Registered: Nov, 2003
|
|
Re: how do you not calculate first row of a multidimensional array?
|
Posted: Nov 9, 2003 10:43 AM
|
|
Just use elements 1 through (SalesArray.length - 1) to do your calculations (element 0 is the salesperson), but print elements 0 through length-1 to produce your report column titles.
> I am trying to use a double array to calculate sales > totals per saleperson and overall averages but do not want > to use the salesperson number in the calculations. Can > someone show me the correct code? > > Below is how I start: > > import java.awt.*; > > public class SalesArray extends JApplet { > int sales[][] = {{1180,45,75,94,65}, > {1181,21,88,89,20}, > {1182,79,51,55,67}}; > > int salesperson, items; > String output; > JTextArea outputArea; > > {rest of code} > > I am trying to not use the first column in my calculation > but to output it only under saleperson and get the > following output: > > Salesperson [1] [2] [3] [4] Average: > 1180 45 75 94 65 > 1181 21 88 89 20 > 1182 79 51 55 67 > > Lowest Sales earned = > Highest Sales earned = > Overall Average = > Mediam of overall Sales =
|
|