Salary program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • punkybrewster
    New Member
    • Oct 2006
    • 11

    Salary program

    Basically my task is to write a program that computes and displays the weekly salaries of a company's salespeople based upon information entered by the user and that also displays the total for the week. Use a loop prompt the user to enter the gross sales in dollars and cents for each salesperson and use -1 to quit ... read in the entered value and display the salary for that salesperson immediately then go on to the next salesperson.

    If the user enter a negative value other than -1 the program will reprompt as many times as needed for a non-negative value but use a nested loop. When the user is finished entering information for each salespeople he will enter -1 in which the program will display the final total salaries of all salespeople. Example: base pay is $250 plus 9.5% of gross sales for the week. If salesperson gross sales for the week is 200 then salary is 250+(200*9.5%)

    Enter gross sales for salesperson#1 (or -1 to end): 200
    Salary for salesperson #1 is $269.00

    Enter gross sales for salesperson #2 (or -1 to end): 427.68
    Salary for salesperson #2 is $368.82

    Enter gross sales for salesperson #3 (or -1 to end): -23.45
    Sales cannot be negative - please reenter:

    etc.

    I started the program but can't get it to count the number successfully for each salesperson and state their salary immediately after. Currently my program hangs and keeps repeating the first result of salary computed. Any ideas has how to do this. I greatly appreciate.
  • vninja
    New Member
    • Oct 2006
    • 40

    #2
    well lets see your code. probably be easier to fix a problem when we can see potential areas where it could be.


    are you using something similar to a while statement

    while(input!=(-1))
    {
    int i=1;
    get (i) 's gross sales;
    input
    if(input<-1)
    error
    else
    i++
    }

    Comment

    Working...