|
To access the contents, click the chapter and section titles.
Learn Pascal in a Three Days (2nd Ed.)
Sample runs: (A) Reading records from the file: In this sample run, three records for three different categories of employees are read from the file. In the fourth attempt to read a record, we entered a social security number which is not in the file, and the message SSN not found in file was received. Notice that the data entered from the keyboard are italicized and bolded for clarity. ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 1 Please enter the SSN of the employee: 434-55-6666 ---------- Employee Record ----------- ID: 1MGT1 Name: James A. Abolrous Position: President SSN: 434-55-6666 Salary: 4343.88 ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 1 Please enter the SSN of the employee: 404-38-1132 ---------- Employee Record ----------- ID: 2STF1 Name: Tara S. Strahan Position: Secretary II SSN: 404-38-1132 Rate: 8.24 ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 1 Please enter the SSN of the employee: 334-88-1234 ---------- Employee Record ----------- ID: 3SAL4 Name: John G. Trainer Position: Sales Representative SSN: 334-88-1234 Commission: 0.25 Basic Salary: 500.00 Area: Baton Rouge, LA ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 1 Please enter the SSN of the employee: 555-55-5555 SSN not found in file. Please try again. ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 3 (B) Appending records to the file: In the following run, a new record is appended to the payroll file: ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 2 Please enter Employee ID: 3SAL6 Name: Barbara Ortiz Position: Sales Representative SSN (xxx-xx-xxxx): 347-12-3456 Payroll category: 3 Commission: .15 Basic salary: 450.0 Area: New Orleans, LA ------------- Main Menu -------------- 1. Display an employee record. 2. Add a new employee. 3. Exit. -------------------------------------- Make a choice and press a number: 3 At this point, the new record of Barbara Ortiz has been appended to the payroll file and may be displayed using option 2. Needless to say, you can also add a record at the end of the file using any text editor. There are some important points in the program:
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |