Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please see the images for the question. Do not copy solutions from chegg or other websites. I will check and give a negative rating if

Please see the images for the question. Do not copy solutions from chegg or other websites. I will check and give a negative rating if you do this. Please include comments in your Pascal code. You must upload your program as screenshots/images, not as text. If you complete the task, I will give a positive rating. Thanks.

image text in transcribed

image text in transcribed

image text in transcribed

Program 3: President records The president file contains records in the form of text lines, one per U.S. president. Each president record contains The president's 3-digit ID The president's first name The president's last name One or more blanks separate the ID and the last and first names. There are no blanks inside the names The records are already sorted by ID. You do not know in advance how many president records there are. The last president record is followed by a dummy record that has -1 in place of the ID Read and store each president's ID, first name, and last name in a Pascal record. Store all the records in an array of records that's large enough to hold 20 records Following the dummy record, there is a list ID numbers. For each ID, search and find the matching president. Input data 123 John Kennedy 172 Lyndon Johnson 265 Richard Nixon 306 Gerald Ford 497 Jimmy Carter 500 Ronald Reagan 668 George Bush 701 Bill Clinton 888 Barack Obama 939 Donald Trump 497 123 666 888 Output After reading in the presidents and storing them in an array of records, print the array. Then for each ID, search the array for the matching president and print that president's first and last name. If there is no match, print "no match". Text input hints . If ch is a character variable, then read (ch) will read the next character from the standard input. A call to readln will skip the rest of the current input line. Then the next call to read will read starting on the next input line. .Boolean functions eoln and eof without parameters test whether the standard input is at the end of the current line or at the end of file, respectively. (If you're typing input data into a Windows command window, a line containing only control-Z is the end-of-file marker. On Linux and the Mac, it's control-D.) Do not use the built-in string type. Represent a string as an array of characters, as in classic Pascal. For example: TYPE FieldARRAY [1. .12] OF char; A string value can only be read one character at a time from the input and entered into the character array. However, an entire string (the entire array) can be written all at once. Blank-fill the end of a string to the length of the array. Program 3: President records The president file contains records in the form of text lines, one per U.S. president. Each president record contains The president's 3-digit ID The president's first name The president's last name One or more blanks separate the ID and the last and first names. There are no blanks inside the names The records are already sorted by ID. You do not know in advance how many president records there are. The last president record is followed by a dummy record that has -1 in place of the ID Read and store each president's ID, first name, and last name in a Pascal record. Store all the records in an array of records that's large enough to hold 20 records Following the dummy record, there is a list ID numbers. For each ID, search and find the matching president. Input data 123 John Kennedy 172 Lyndon Johnson 265 Richard Nixon 306 Gerald Ford 497 Jimmy Carter 500 Ronald Reagan 668 George Bush 701 Bill Clinton 888 Barack Obama 939 Donald Trump 497 123 666 888 Output After reading in the presidents and storing them in an array of records, print the array. Then for each ID, search the array for the matching president and print that president's first and last name. If there is no match, print "no match". Text input hints . If ch is a character variable, then read (ch) will read the next character from the standard input. A call to readln will skip the rest of the current input line. Then the next call to read will read starting on the next input line. .Boolean functions eoln and eof without parameters test whether the standard input is at the end of the current line or at the end of file, respectively. (If you're typing input data into a Windows command window, a line containing only control-Z is the end-of-file marker. On Linux and the Mac, it's control-D.) Do not use the built-in string type. Represent a string as an array of characters, as in classic Pascal. For example: TYPE FieldARRAY [1. .12] OF char; A string value can only be read one character at a time from the input and entered into the character array. However, an entire string (the entire array) can be written all at once. Blank-fill the end of a string to the length of the array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Explain how to build high-performance service delivery teams.

Answered: 1 week ago