public class Sales
{
// counts the number of people in given salary ranges
public void countRanges()
{
// initialize the values in the array to zero
// read in values and assign them to the appropriate range
while ( dollars >= 0 )
{
//Calculate salary and ger range by salary / 100 ;
if ( range > 10 )
range = 10;
//count totals for every range
//Enter next sales amount (negative to end);
} // end while
// print chart
} // end method countRanges
} // end class Sales
ASKER
public class Sales
{
public static void main( String args[] )
{
int array[] = { 500, 250, 650, 325, 575, 229, 979, 1200, 425, 875, 750 };
System.out.println( "Salary Statistics:" );
// for each array element, output a bar of the chart
for ( int counter = 2; counter < array.length; counter++ )
// output bar label ( "$200-299: ", ...,"$800-899: ", "$900-999: ", "$1000 and over: " )
if ( counter == 10 )
System.out.printf( "%5d and above: ", 1000 );
else
System.out.printf( "%02d-%02d: ",
counter * 100, counter * 100 + 99 );
// print bar of asterisks
for ( int stars = 0; stars < array[ counter ]; stars++ )
System.out.print( "*" );
System.out.println(); // start a new line of output
} // end outer for
} // end main
} // end class Sales
public class Sales
{
public static void main( String args[] )
{
int array[] = { 500, 250, 650, 325, 575, 229, 979, 1200, 425, 875, 750 };
System.out.println( "Salary Statistics:" );
// for each array element, output a bar of the chart
for ( int counter = 2; counter < array.length; counter++ ) {
// output bar label ( "$200-299: ", ...,"$800-899: ", "$900-999: ", "$1000 and over: " )
int counter1 = counter * 100;
int counter2 = counter1 + 99;
int noofsalesman = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] >= counter1 && array[i] <= counter2)
noofsalesman++;
}
if ( counter == 10 )
System.out.printf( "%5d and above: %4d", 1000, noofsalesman);
else
System.out.printf( "%02d-%02d: %4d", counter1, counter2, noofsalesman);
// print bar of asterisks
/*for ( int stars = 0; stars < array[ counter ]; stars++ ) {
System.out.print( "*" );
}*/
System.out.println(); // start a new line of output
} // end outer for
} // end main
} // end class Sales
Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.
TRUSTED BY
ASKER