CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    4

    Any help for my final project

    ASSIGNMENT

    1. Create a project to process payroll information for Ace Industries Inc.

    2. Project has to use at least 3 forms: Payroll form, DataEntry form and Salary form (feel free to add other forms and standard modules.)

    3. Create a sequential file and call it Employee. Each record will contain fields for first name, last name, hourly pay rate and amount earned. Starting the project will load the employee data into an array of user﷓defined types from the sequential file.

    4. DataEntry form allows adding new employee to the file and printing the list of all Ace Industries Inc employees and their rates. (Supposed all of them have different first names ).

    5. Salary form retrieves salary information including first name, last name, pay rate, worked hours, overtime and salary. Overtime counts as worked hours over 40. Employees receive for overtime time﷓and﷓a﷓half pay. The user has a choice to include salary information in the report or ignore it.

    6. Payroll Form
    a) Allows switching to the DataEntry form.
    b) Allows selecting any employee
    c) Allows finding any employee using employee first name
    d) Allows calculating of a salary and printing report.

    7. Add to the Payroll form FindPay command button or menu command for calculating salary. It has to be accessible only after selecting any employee. Use InputBox to enter worked hour's information.

    8. Printing report should contain the list of first and last names, worked hours and overtime hours, pay rate, salary and total amount earned for all employees.

    9. First name, last name, hourly pay rate and amount earned have to be automatically saved in the Employee file.

    10. For self-checking use this table:


    Employee Name Hours Worked Hours Overtime Pay rate Amount Earned

    Janice Jones 40 0 5.25 210.00
    Chris O’Connell 35 0 5.35 187.25
    Karen Fish 45 5 6.00 285.00
    Tom Winn 42 2 5.75 247.25

    Totals 162 7 929.50




    ANY HELP WILL BE APRETIATE
    [email protected]



  2. #2
    Join Date
    Apr 2001
    Location
    Wisconsin, USA
    Posts
    150

    Re: Any help for my final project

    Ok. I am not sure what you have already, but I will try to answer some (if not all) of your questions.

    2. You should be able to create the forms.
    3. Open Notepad and create a file called Employee.dat. Each line in the file will contain all the information you need stored in there, separated by commas. For example:

    'Janice','Jones',40,0,5.25,210

    Repeat this for every employee you need to add. Furthermore, you shouldn't need to store totals in this file, as totals are nothing more than a calculation.

    Now things get tricky. When you start the application, the first thing you want to do is read the file, and then store each piece of information in an array (preferrably a different array for each type of information, as multidimensional arrays get icky). So, your initial form load should look like this:

    Const filename As String = "a:\employee.dat"
    Dim First(100) As String
    Dim Last(100) As String
    Dim HourlyRate(100) As Currency
    Dim Wages(100) As Currency
    Dim Counter As Integer

    Open filename For Input As #1

    Counter = 0
    Do Until EOF(1)
    Input #1, First(Counter), Last(Counter), HourlyRate(Counter), Wages(Counter)
    Counter = Counter + 1
    Loop

    Close #1

    This will open the file, store all the information you need in the appropriate arrays (at the appropriate spot for each record), and then close the file.

    Now, some of your other questions become easier. For instance: Searching on the first name. All you need to do is set up a new counter = 0 (don't reset the original counter to 0 as this holds the total number of array elements), and loop through first name array until you either find the first name, or the array has been searched through. Like this:

    dim FirstName as string
    dim lastname as string
    dim rate as currency
    dim totalwage as currency
    dim counter2 as string

    firstname = txtfirstname.text
    lastname = ""
    rate = 0
    totalwage = 0
    counter2 = 0

    do until counter2 > counter
    if firstname = first(counter) then
    lastname = last(counter)
    rate = hourlyrate(counter)
    totalwage = wages(counter)
    exit do
    end if
    counter2 = counter2 + 1
    loop

    if lastname = "" then
    msgbox("No such person found. Please try again.")
    exit sub
    end if

    Then you just fill the text boxes with the information retrieved from the search (assuming that information was found and the message box wasn't displayed).

    This should give you a decent start. Need any more help, just email me at [email protected] and I will get back to you as soon as I can.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured