QBASIC help(new to programing)

Discussion in 'All other topics' started by battle4my, Oct 8, 2003.

  1. battle4my

    battle4my Member

    Joined:
    Aug 13, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    11
    Ok heres's what I have so far....


    REM FirstName variable holds Employee First Name
    REM LastName variable holds Employee Last Name
    REM RateOfPay variable that holds employee pay rate
    REM HoursWorked variable that holds number of hours worked by employee
    REM GrossPay variable holds amount of employee salary
    REM Bonus variable holds amount added to GrossPay
    REM Salary variable for Employee Salary
    REM Deduction variable for amount taken off Employee GrossPay
    REM NetPay variable for amount of pay after Deductions


    '******** Program Mainline ********

    CLS
    GOSUB EmployeeInfo
    GOSUB PayInfo
    GOSUB PrintInfo


    END



    '******** Employee Information ********
    EmployeeInfo:
    INPUT "Enter First Name"; FirstName$
    INPUT "Enter Last Name"; LastName$
    INPUT "Enter paytype, H for Hourly S for Salary"; HorS$
    IF UCASE$(HorS$) = "H" THEN
    INPUT "Enter Rate of Pay"; RateOfPay
    INPUT "Enter Hours Worked"; HoursWorked
    ELSE

    RETURN

    '******** Calculate Employee Pay ********

    PayInfo:
    GrossPay = RateOfPay * HoursWorked
    IF GrossPay >= 400 THEN
    Bonus = 25
    ELSE
    Bonus = 0
    END IF



    RETURN

    '******** Display Employee Information ********

    PrintInfo:
    PRINT "Employee Full Name is: "; FirstName$; " "; LastName$
    PRINT "Employee Pay Rate"; RateOfPay
    PRINT "Number of hours worked"; HoursWorked
    PRINT "Employee Gross Pay"; GrossPay
    PRINT "Employee Bonus"; Bonus

    RETURN



    I know that the program is incomplete, Im having trouble getting the loops to function properly. I am BRAND NEW to programing I desperatly need help I need to the following incorperated into my program. Im having problems placing in the tax decutible line as well. Here is the rest of the assingment so you might have a better understanding of what I need to do.

    Loop the program until no more employees
    Inlude a new decioion point within the Employee information section to incude Hourly "H" or Salary "S"
    If the employee is Hourly then ask for Rate of Pay and Hours Worked
    If Salary ask for Salary Rate i.e 625

    Include a new decision point within the Calculation section
    If Hourly calculate Gross Pay
    If Salary, Salary Rate equls Gross Pay
    Claculate a Deduction of .06 of Gross Pay i.e Gross Pay * .06 = Deduction

    Include a new decision point within the Print section for Hourly(Rate of Pay and Hours worked) or Salary(Salary Rate) for different output to screen

    Print out the employee First Name, Last Name, (Rate of Pay, Hours Worked) or (Salary), Gross Pay, Net Pay and Deduction

    Thanks in advance for any assistance
     
  2. Xian

    Xian Regular member

    Joined:
    Jun 27, 2003
    Messages:
    954
    Likes Received:
    0
    Trophy Points:
    26
    I have never messed with qbasic but I can see that your main program does not loop. It needs to be in a loop as well or else the functions will just be called a single time and the program will end after returning from the last Gosub.
     

Share This Page