01. Write a Pascal program that prints your name to the screen, and then pauses, waiting for the user to press the Enter key. Save the final program as STEP01.PAS.
02. Load STEP01.PAS, and save as STEP02.PAS. Then modify STEP02.PAS as follows: The data file PEOPLE.DAT contains a series of records with a name of one person and other information on each line, one person per line. Each line (name and other data) is longer than 80 characters. After displaying your name, your program must read this file and print each line to the screen, one input line per screen line. Use simple string I/O - do not use records. Pause the screen waiting for the user to press Enter when done. Save the program as STEP02.PAS when complete.
03. Load STEP02.PAS and save as STEP03.PAS. Then modify STEP03.PAS as follows: The name portion of each line of PEOPLE.DAT is in columns 1-20, with no leading or extra spaces, although there may be trailing spaces. The name is in the order Last, First, so that a typical line in the file might look like
Smith, John (other data starts here)Your program should read in each name from the file (either directly or by extracting it from an input data line), and print it to the screen with the names in First Last order, as in
John Smithone name per line. Use simple string I/O - do not use records. Save the program as STEP03.PAS when complete.
04. Load STEP03.PAS and save as STEP04.PAS. Then modify STEP04.PAS as follows: There are no more than 50 lines of data in PEOPLE.DAT. Create an array capable of holding the names from the file, and load this array with the names from the file. Store each name as a single string-type data item in its original Last, First order. Do not use records. Pause the screen. Display all the names in their original Last, First order, one per line, on the screen. Pause the screen. Display all the names in the order First Last (one per line). Pause the screen. Save the program as STEP04.PAS when complete.
05. Load STEP04.PAS and save as STEP05.PAS. Then modify STEP05.PAS as follows: Load the names in PEOPLE.DAT into an array, sort the array in ascending order by last name (the names should already be stored in Last, First style), and display the results on the screen, one name per line, in First Last style. You may use any sort you wish. Pause the screen. Save the program as STEP05.PAS when complete.
06. Load STEP05.PAS and save as STEP06.PAS. Then modify STEP06.PAS as follows: In the file PEOPLE.DAT, following the names in columns 1-20, there is an ID number in columns 21-29, as in
Smith, John 123456789Create a record data type to hold both the name and the ID number, and modify the array used previously to store records of this type. Modify the program to load this new array of data, sort it in ascending order by ID number, and then display the results on the screen, one person per line, in the order ID number - First Last as in
123456789 - John SmithPause the screen. Save the program as STEP06.PAS when complete.
07. Load STEP06.PAS and save as STEP07.PAS. Then modify STEP07.PAS as follows: Load the data records into the data array and sort in ascending order by ID number as in step 06. Do not display the results, but do display a message "Loading data …" as the array is being loaded and sorted. Then prompt the user for an ID number, and conduct a binary search for a matching ID in the array. If found, display the name from the matching record (in First Last style) on the screen. If not found, respond with an appropriate message. Pause the screen. Save the program as STEP07.PAS when complete.
08. Load STEP07.PAS and save as STEP08.PAS. Then modify STEP08.PAS as follows: Load and sort the array by ID number as before. Prompt, search and display results as in step 07. Repeat the cycle of prompt, search and display until the ID number 000000000 is entered. Then display summary data consisting of the total number of searches conducted, the number of successful searches, and the number of failures. Pause the screen. Save the program as STEP08.PAS when complete.
09. Load STEP08.PAS and save as STEP09.PAS. Then modify STEP09.PAS as follows: The file PEOPLE.DAT contains credit card customer account data. The name and ID number are stored as before; following these, separated by at least one space, is an account limit (real) and current account balance (real). Modify the primary array data record to accommodate this new data. Load and sort as before, by ID number. Prompt the user for an ID number and a charge amount. Then report one of the following as appropriate:
Charge rejected - Invalid ID Number Charge rejected - Insufficient funds Charge approved.When a charge is approved, update the current account balance by adding the charge amount to it. Repeat prompting and responding until 000000000 is entered as before. Include the total amount of all new charge requests and all approved charges in the summary. Pause the screen. Save the program as STEP09.PAS when complete.
End of Exam