In some need of some serious help in converting this pseudo code into C#:

start
Declarations
    num deptNum
    num salary
    num hrsWorked
    num SIZE = 7
    num totalGross[SIZE] = 0
    string DEPTS[SIZE] = “Personnel”, “Marketing”,
                   “Manufacturing”, 
                   “Computer Services”, “Sales”, 
                   “Accounting”, “Shipping”
getReady()
while not eof
            detailLoop()
endwhile 
finishUp()
stop

getReady()
    output “Enter the department number, hourly salary, and number of 
  hours worked”
input deptNum, salary, hrsWorked
return

detailLoop()
        if deptNum >= 1 AND deptNum <= SIZE then
            totalGross[deptNum-1] = totalGross[deptNum-1] +                                 (hrsWorked * salary)
        else
            output “Invalid department number”
        endif
output “Enter the department number, hourly salary, and number of 
  hours worked”
input deptNum, salary, hrsWorked
    return

    finishUp()
deptNum = 0
while deptNum < SIZE
    output deptNum+1, DEPTS[deptNum], totalGross[deptNum]
    deptNum = deptNum + 1
endwhile
    return

Any and all help will be appreciated.
Thanks,
PickledPepper6

Recommended Answers

All 4 Replies

This looks like a homework assignment. What have you tried so far?

All I have done is set up public bool's for isvalid, ispresent, iswithinrange, and set up a calculator for the gross pay too. I have no idea how to make it output a list of the seven departments in the company (numbered 1 through 7) and the total gross payroll (rate times hours) for each department.

I have to organize each employee entered (firstname and lastname) based on their department and then sum up the total per department

MSDN is a great resource to get started.
In this article you will find info on how to convert your DEPTS array on line 8 into a legitimate C# line. Success!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.