| | |
simple array problem not so simple
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 17
Reputation:
Solved Threads: 0
I have been working on this array problem since last Friday. We are to accept an employee's gross sales, multiply that by 9%(to find commission) add $200 for weekly salary. Then the program takes that dollar amount and tallies payroll with ( *'s) beside salary groupings....
ex
$200-299 ****
$300-399 **
$400-499* ......ect
my problem is I can't get this to complie to even see how close I am. My compiler keeps giving this error...
\Sales.java:30: ')' expected
salary = (double 200 + (grossSales * .09 ));
^
java:30: ';' expected
java:30: ';' expected
salary = (double 200 + (grossSales * .09 ));
^
I'm lost and frustrated and need some advice......Here is what I have
ex
$200-299 ****
$300-399 **
$400-499* ......ect
my problem is I can't get this to complie to even see how close I am. My compiler keeps giving this error...
\Sales.java:30: ')' expected
salary = (double 200 + (grossSales * .09 ));
^
java:30: ';' expected
java:30: ';' expected
salary = (double 200 + (grossSales * .09 ));
^
I'm lost and frustrated and need some advice......Here is what I have
Java Syntax (Toggle Plain Text)
/import java.util.Scanner; public class Sales { //counts number or salespersons in different salary ranges public void countRanges() { Scanner input = new Scanner( System.in ); double salary;//salespersons pay double grossSales;//sales to base commission of 9% on //ininialize the values in the array to zero salary = 0; grossSales = 0; //read in values and assign them to the appropriate ranges System.out.print( "Enter Gross Sales or enter a negative number to exit" ); dollars = input.next.Int(); grossSales = dollars; while ( dollars >= 0 ) { //calculate salary an get range by salary/100 salary = (double 200 + (grossSales * .09 )); range = ( salary/100 ); if ( range > 10 ) range = 10; //count totals for every range for ( int counter = 0; counter < array.length; counter++ ) total += array[ counter ]; if ( counter == 10 ) System.out.printf( "%5d: ", 1000 ); else System.out.printf( "%3d-%3d: ", counter * 100, counter * 100 + 9 ); //enter next sales amount (negative to end) System.out.print( "Enter next Gross Sales or enter a negative number to exit" ); grossSales = input.nextInt(); }//end while //print chart for ( int stars = 0; starts < array [counter]; star++ ) System.out.print( "*" ); }//end method countRanges }//end class Sales
Last edited by tmoney7566; Feb 3rd, 2009 at 7:22 pm.
![]() |
Similar Threads
- Another counting problem (C)
- File array question (C++)
- Array Problem (C++)
- 2D-Array, switches, and importing from a file (C++)
- Output 2D array? (C++)
- Playing with shared memory - problem with non 'simple' data types (C++)
- Array problem (C)
- Array with names (C)
- How do I create a program using an Array ? (C++)
- Array limit (C)
Other Threads in the Java Forum
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






