Searching Kana is a teacher who teaches history lessons. Kana has many students from several classes. To make searching student easier, Kana merge the list of students in a document. The list made by Kana is sorted based on the student identification number. But because of the large number of students, Kana needed time to look for it. Kana asks for your help to create a program that can improve student searches based on their identification numbers. Format Input Read from file “testdata.in”. First line, consists of one integer N, number of students record. Next N lines consists of two field per line which are student identification number D and students name M. M only consists of one word. Next line consists of one integer T, number of test case given. For each test case, there is a line of S, which is student identification number that need to be found. Format Output Output should be expressed in format “Case #X: M” where M is students name. If there is no such student identification number, then output “Case #X: N/A” where N/A means not available. Constraints • 1 ≤ N ≤ 100 • |D|, |S| = 10 (|X| means length of string X) • 1 ≤ T ≤ 100 • 1 ≤ |M| ≤ 20 • The list is already sorted based on the student identification number in ascending order. • D and S only consists of digits 0-9. • M only consists of letters a-z and A-Z. Sample Input (testdata.in) 13 2020123456 Liam 2020123457 Noah 2020123458 William 2020123459 James 2020123460 Logan 2020123461 Benjamin 2020123462 Mason 2020123463 Elijah 2020123464 Oliver 2020123465 Jacob 2020123466 Lucas 2020123467 Michael 2020123468 Alexander 4 2020123456 2020123468 2020123462 2020100000 Sample Output (standard output) Case #1: Liam Case #2: Alexander Case #3: Mason Case #4: N / A

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Searching


Kana is a teacher who teaches history lessons. Kana has many students from several classes. To make searching student easier, Kana merge the list of students in a document. The list made by Kana is sorted based on the student identification number. But because of the large number of students, Kana needed time to look for it. Kana asks for your help to create a program that can improve student searches based on their identification
numbers.


Format Input
Read from file “testdata.in”. First line, consists of one integer N, number of students record. Next N lines consists of two field per line which are student identification number D and students name M. M only consists of one word. Next line consists of one integer T, number of test case given. For each test case, there is a line of S, which is student identification number that need to be found.


Format Output
Output should be expressed in format “Case #X: M” where M is students name. If there is no such student identification number, then output “Case #X: N/A” where N/A means not available.


Constraints
• 1 ≤ N ≤ 100
• |D|, |S| = 10 (|X| means length of string X)
• 1 ≤ T ≤ 100
• 1 ≤ |M| ≤ 20
• The list is already sorted based on the student identification number in ascending order.
• D and S only consists of digits 0-9.
• M only consists of letters a-z and A-Z.

Sample Input (testdata.in)
13
2020123456 Liam
2020123457 Noah
2020123458 William
2020123459 James
2020123460 Logan
2020123461 Benjamin
2020123462 Mason
2020123463 Elijah
2020123464 Oliver
2020123465 Jacob
2020123466 Lucas
2020123467 Michael
2020123468 Alexander
4
2020123456
2020123468
2020123462
2020100000


Sample Output (standard output)
Case #1: Liam
Case #2: Alexander
Case #3: Mason
Case #4: N / A

Use C language, linear searching, file processing, only use library stdio.h and string.h. Don't use malloc.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT