Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help me fix my QBasic program :(
#1
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
Reply
#2
Here, I have added some Ifs and a DO...LOOP statement.

Code:
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 ********

EmpDone% = 1
DO
   CLS
   GOSUB EmployeeInfo
   GOSUB PayInfo
   GOSUB PrintInfo
   PRINT "Do you wish to continue?";
   a$ = INPUT$(1)
   IF UCASE$(a$) = "N" THEN EXIT DO
   EmpDone% = EmpDone% + 1
LOOP

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
END IF

RETURN

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

PayInfo:

'IF UCASE$(HorS$) = "H" THEN
'  'Calculate Gross Pay for the emp(hourly) here
'  'GrossPay = something
'ELSE
'  'Calculate Gross Pay for the emp(Salaried) here
'  'GrossPay = something
'END IF

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

'Deduction% = 0.6 * GrossPay%


RETURN

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

PrintInfo:
PRINT "Employee Full Name is: "; FirstName$; " "; LastName$

'IF UCASE$(HorS$) = "H" THEN
'   PRINT "Employee Pay Rate"; RateOfPay
'   PRINT "Number of hours worked"; HoursWorked
'ELSE
'   PRINT "Salary"; EmpSalary
'END IF

PRINT "Employee Gross Pay"; GrossPay
PRINT "Employee Bonus"; Bonus

RETURN

The remmed statements i.e. those statements which begin with a ' are the pseudo code you need to use.

Please tell me if it helped Big Grin
Reply
#3
WOW! Thanks! I'll give it a shot :lol: I will let you know if it works.
Reply
#4
So, did u try it?
Reply
#5
He either got abducted by aliens, or it didn't work.

BTW: 00.5% of the US population claims to have been abducted by aliens.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#6
Quote:...00.5% of the US population claims to have been abducted by aliens.
thats a lot
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#7
I was abducted twice does that mean i count for 2 people or still just myself? :???:
Reply
#8
Hmm...I think we should go and ask the aliens themselves =)
Reply
#9
We only have to find them Smile
Reply
#10
Thats easy. Just put Lanzaa out in a field and the aliens will abduct him for the 3rd time. Will he then be counted for 3 people or 1 person abducted thrice or 2 people(since the 3rd time he went on purpose) or 1 person abducted twice???

Many questions....???
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)