I have a project that is receiving compilation errors, which I am not sure how to fix. Each time I make changes in an attempt to fix my code I end up with more errors. Can someone look into?
Commissions8Test is as follows:
public class Commissions8Test
{
public static void main( String[] args )// ..................................main method begins program execution
{
int[] salarysArray = { 8700, 6800, 9400, 10000, 8300, 7800, 8500, 9100, 7600, 8700 }; // .....one-dimensional array of employee salarys
Commissions8 myCommissions8 = new Commissions8( salarysArray );
myCommissions8.processsalarys();
} // ........................................................................end main
} // ...........................................................................end class Commissions8Test
Commissions8 is as follows:
public class Commissions8
{
private double[] salarys; // ..................................................8.Barray of employee salarys
public Commissions8( salarysArray )// ..................11two-argument constructor initializes courseName and salarys array
{
salarys = salarysArray; // .............................................14store salarys
} //.......................................................................15end two-argument Commissions8 constructor
public void processsalarys()// ..............................................METHOD... processsalrys
{
System.out.println();//...................................................print line
outputBarChart(); // ...................................................Calls outputBarChart to print salary distribution chart
} // ........................................................................end method processsalarys
public void outputBarChart()// ..............................................METHOD... outputBarChart
{
System.out.println( "Salary Distribution:" );//...........................HEADER... "Salary Distribution"
int[] frequency = new int[ 11 ];// .......................................Declares/Create array freq. of 11 ints to store the frequency of salary's in each salary category
for ( double salary : salarys )// ...........................................for each salary, increment the appropriate frequency
//++frequency[ salary / 1000 ];
++frequency[(salary * .09 + 200) / 1000 ];
for ( int count = 0; count < frequency.length; count++ )// ...............for each salary frequency, print bar in chart
{
if ( count == 10 )// ..................................................output bar label ( "000-099: ", ..., "900-999: ", "1000: " )
System.out.printf( "%5d: ", 1000 );
else
System.out.printf( "%02d-%02d: ",
count * 1000, count * 1000 + 999 );
for ( int stars = 0; stars < frequency[ count ]; stars++ )// ..........print bar of asterisks
System.out.print( "*" );
System.out.println(); // ..............................................start a new line of output
} // .....................................................................end outer for
} // ........................................................................end output bar chart displaying salary distribution
} // ...........................................................................end class Commissions8
Compilation errors are as follows
Commissions8Test.java:
Line 11 ... Commissions8 myCommissions8 = new Commissions8( salarysArray );
Cannot find symbol
symbol: Constructor Commissions8(int[])
location: class Commissions8
Commissions8.java:
Line 10 ... public Commissions8( String name, salarysArray )
Cannot find symbol
symbol: class salarysArray
location: class Commissions8
<identifier> expected
Line 12 ... salarys = salarysArray;
Cannot find symbol
symbol: variable salarysArray
location: class Commissions8
Line29 ... ++frequency[(salary * .09 + 200) / 1000 ];
possible loss of precision
found : double
required : int
THx,
Samm

New Topic/Question
Reply




MultiQuote







|