I don’t know how to handle this Python question and need guidance.
1 // Variables for the fields
2 Declare String name_x000D_ 3 Declare Integer idNumber_x000D_ 4 Declare String department_x000D_
6 // Declare an input file.
7 Declare InputFile employeeFile
9 // Open a file named employees.dat.
10 Open employeeFile “employees.dat”
10.4 Processing Records 401
12 Display “Here are the employee records.” 13
14 // Display the records in the file.
15 While NOT eof(employeeFile)
- 16 // Read a record from the file.
17 Read employeeFile name, idNumber, department_x000D_
- 19 // Display the record.
20 Display "Name: ", name_x000D_
21 Display "ID Number: ", idNumber_x000D_
22 Display "Department: ", department_x000D_
- 24 // Display a blank line.
- 25 Display
26 End For
28 // Close the file. 29 Close employeeFile
Here are the employee records. Name: Colleen Pickett
ID Number: 7311
Name: Ryan Pryce_x000D_ ID Number: 8996_x000D_ Department: Security_x000D_
Name: Bonnie Dundee_x000D_ ID Number: 2301_x000D_ Department: Marketing_x000D_ _x000D_ _x000D_
If you are a programmer for a company or an organization, you will most likely have to write programs that read data from files that already exist. The files will probably be stored on the company’s servers, or on some other computer that is part of the com- pany’s information system. When this is the case, you will not know how the data is organized inside the files. For that reason, companies and organizations usually have a file specification document for each data file. A file specification document describes the fields that are stored in a particular file, including their data types. A programmer who has never previously worked with a particular file can consult that file’s specifica- tion document to learn how data is organized inside the file.
A company or organization might keep file specification documents stored as word processing documents, PDF documents, or plain text documents. (In some cases, they might be printed on paper.) The contents of a file specification document will look dif- ferent from one organization to another, but in each case, it will provide the information that a programmer needs to work with a particular file. Figure 10-20 shows an exam- ple of a file specification document for the employees.dat file that was used in Pro- gram 10-7 and Program 10-8.
- 1. Design the program using Raptor.
- 1. You MUST use Modular Programming techniques by using Sub Modules (Sub Charts in RAPTOR) in your program. Your “main” module should not be very large.
- • Documentation: Use the “Comments” feature to document each symbol in the flowchart. You do this by right-clicking the symbol and selecting “Comment.” Be sure to identify the data type of each variable used. Be sure to explain what each formula does. Be sure to explain what each of the other symbols in the flowchart does in a comment.
- • Test and debug your Program: Create sample input data, run the program, then check your answers with a calculator or Excel. If something did not match up, then fix your program.