Can someone help me?

timmins316

Member
Joined
Feb 9, 2005
Messages
6
Programming Experience
Beginner
Does anyone have example code for the following info. Please and thank you.

The Project
You are writing part of a program for a community college. Your portion will use files to read and write data.

Personnel Report

The purpose of this menu option is to read data from input file Personnel.txt and create output file(s) containing a report. Your program will create file StaffReport.txt when the Staff radio button is on and create file FacultyReport.txt when the Faculty radio button is on.



Create the report described below by reading a line of data from the input file then printing a line of data to the appropriate output file. Repeat until the end of the file is reached.

1. Sample data from file Personnel.txt is shown below:

"123BUA","Jason Alexander","Staff"

"483VTD","Benjamin Bratt","Faculty"

The employee code appears first followed by the name and status. The employee code includes employee number (first 3 characters), department code (next 2 characters) and benefits package (last character).

2. Each line of the report should contain the department code, name and status. The department code appears first, then the name followed by the status.

3. The title for this report is Report of All fill in name. (ie faculty or staff).

4. Use PrintLine to write a line of the data to an open file. For example, the code:

PrintLine(3, "Name ", TAB(25), "Program", TAB(40), "Amount Paid")

writes 1 line to file #3. TAB(25) means jump to column 25.

Student Records Report

The purpose of this menu option is to read data from input file Students.txt and create output file(s) containing a report. Your program will look at the user’s choice in the list box and create an appropriate output file. For example, if CPA has been selected in the list box, then the program should create file CPA.txt.



Create the report described below by reading a line of data from the input file then printing a line of data to the appropriate output file. Repeat until the end of the file is reached.

.

1. The data in file students.txt shows the student name first followed by the program and the amount of tuition paid to date.

2. Each line of the printed report should contain the student name, program and amount paid. The name appears first, then the program and the amount. You need the amount paid column to be right justified so that numbers line up. For example, the data portion of your report should look something like:



Little Foot CNTS 1,928.19

Keifer Sutherland CNTS 1,235.83

Martin Sheen CNTS 199.99

Cruella de Ville CNTS 0.00

Friar Tuck CNTS 7.98

Note that the numbers are right justified and formatted with commas and 2 numbers to the right of the decimal (try the FormatNumber command). To make this work, you need to pad the numbers with preceding blanks. Use the length of the number and a For loop to insert blanks at the beginning of each number.

3. The title for this report is Report of Students in the fill in name Program.



Notes

1. Your code should contain 3 Do While loops (one in each procedure) and 1 For loop. There should be no additional loops.

2. Place the following at the top of each report:

¨ your name on line 1.

¨ one blank line.

¨ title as specified above.

¨ one blank line.

¨ column headings.

3. At the end of each report, include a line stating End of Report.

4. Your program should not assume predefined file sizes. It must work with files of different sizes ie the input files may have 5 lines, 50 lines etc.

 
1) Please post a relevant subject line, not "Please help me"
2) We will gladly assist with any code issues, but people here are not going to do your school work for you. Post what you have done and if you run into an error, we'll try to assist
 
Here's what I got so far.
Private Sub AssignmentForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim strProgram As String, strDepartmentcode As String, strName As String

Dim strStatus As String, strfilename As String

strfilename = "Staffreport.txt"

Try

FileOpen(1, "Personnel.txt", OpenMode.Input)

If StaffRadioButton.Checked = True Then

Try

FileOpen(1, strfilename, OpenMode.Output)

Do While Not EOF(1)

PrintLine(1, "Report of all", strStatus)

PrintLine(1, "Name ", TAB(25), "Program", TAB(40), "Amount Paid")

Input(1, strDepartmentcode.Remove(0, 3).Remove(5, 1))

Input(1, strName)

Input(1, strStatus)

Loop

PrintLine(1, "End of report")

Catch

End Try

FileClose(3)

End If

Catch

End Try

FileClose(1)

ProgramListBox.Sorted =
True

Try

FileOpen(1, "programs.txt", OpenMode.Input)

Do While Not EOF(1)

Input(1, strProgram)

ProgramListBox.Items.Add(strProgram)

Loop

FileClose(1)

Catch

End Try

End Sub

 
Back
Top