# QBASIC, Computers

posted by .

The following is a list of salaries of the six employees in a certain company:

Name Salary
T. Angel \$43,000
F. Smith \$31,000
K. Johnston \$22,000
P. Miner \$18,000
C. Altman \$27,000
A. Lu \$19,000

Read a single dimension array for name and another array for Salary. Calculate and output the average salary for the company as well as the names of all people whose salaries exceed the average.

How would I write this program?

Maybe something like this?

DIM EmployeeNam(1 TO 16), Salary(1 TO 6)

GOSUB InitializeVariables
GOSUB LoadTables
CLS
GOSUB PrintDetail
GOSUB PrintSubtotals
GOSUB PrintTotals
END

InitializeVariables:
LET PageCt = 0
LET Salary = 0
LET T1\$ = " Salary for employees ##"
LET H1\$ = ""
LET H2\$ = " Name Salary "
LET D1\$ = " \ / \$###.## "
LET ST\$ = " \ \ SUBTOTAL #"
LET TL\$ = " TOTAL #"
LET MaxLines = 30
RETURN

'******************************
' Read numbers into the array
' *****************************

LoadTables:
FOR N = 1 TO 6
READ EmployeeNam(N), Salary(N)
LET AvgSalary = Salary + Salary(N)
NEXT N

DATA T. Angel, 43,000
DATA F. Smith, 31,000
DATA K. Johnston,22,000
DATA P. Miner, 18,000
DATA C. Altman, 27,000
DATA A. Lu, 19,000
DATA 0,0,0
DATA END
RETURN

PrintDetail:
PRINT H2\$
FOR N = 1 TO 6
PRINT USING D1\$; EmployeeNam(N); Salary(N); 'Print details
NEXT N
RETURN

PrintSubtotals:
LET AvgIncome = Salary / 6 'Calc average income
RETURN

PrintTotals:
PRINT USING "\$##,###.## \ \"; AvgSalary; "is the average Salary"
GOSUB PrintAboveAverage
RETURN

PrintAboveAverage:
PRINT H2\$
FOR N = 1 TO 6
IF Salary(N) > AvgSalary THEN
PRINT USING D1\$; EmployeeNam(N); Salary(N)
END IF
NEXT N
RETURN

Can someone please help me

• QBASIC, Computers -

Looks like you have a good start. Have you tried actually running it?

• QBASIC, Computers -

Yes, It doesnt print anything to the output screen and I get a syntax error on the READ line....

READ EmployeeNam(N), Salary(N)

## Respond to this Question

 First Name School Subject Your Answer

## Similar Questions

1. ### Math

What is the percent increase in the population for all six inhabited continents from 1950 - 2000?
2. ### math

vickie earns \$20,000 a year as a bookkeeper. if she receives a raise of 2%, how could her new total salary be represented?
3. ### Accounting

O' Hara Company began operations on December 1, 2011. Presented below is selected information related to O' Hara Company at December 31, 2011. Office Equipment ₤ 40,000; Utilities Expense ₤ 6,000; Cash 14,000; Accounts …
4. ### healthcare fiancare

HINT: 6% X \$1,000,000 – {20% X (\$1,000,000 – (6% X \$1,000,000))} = 6% X \$1,000,000 – {20% X (\$1,000,000 - \$60,000))}= 6% X \$1,000,000 - {20% X \$940,000}= 6% X \$1,000,000 - \$188,000 = \$60,000 - \$ 188,000= -\$128,000 A) The interst …
5. ### math

vickie earns \$20,000 a year as a bookkeeper.if she receive a raise of 2%,how could her new total salary be represented?
6. ### Math

Would 72,060,964,765 look like the following in it's expanded form?
7. ### programming concepts

Input a list of employee names and salaries stored in parallel arrays. The sal-aries should be floating point numbers in increments of 100. For example, a salary of \$ 36,000 should be input as 36.0 and a salary of \$ 85,900 should be …
8. ### math

The data set represents the income levels of the members of a country club. Estimate the probability that a randomly selected member earns at least \$98,000. 112,000 126,000 90,000 133,000 94,000 112,000 98,000 82,000 147,000 182,000 …
9. ### statistics

The data set represents the income levels of the members of a country club. Estimate the probability that a randomly selected member earns at least \$98,000. 112,000 126,000 90,000 133,000 94,000 112,000 98,000 82,000 147,000 182,000 …
10. ### Math

Help on, what is this in word form. \$10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000. I need to know like 1 Million, trillion?

More Similar Questions