-5

I am new to stackoverflow and programming and I am high school student can you please help. Here is the question

The data file used in this question has folllowing data

ID:Name:Final 
18273640:Annette Adams:98
93840219:Mary Beard:87 
23958552:Antoinette Brown:79 
23958231:Claribel Cone:78 
23958548:Ema Chang:69 
23958664:Heesook Kim:98 
23958115:Larry Liu:98 
23958238:Brad Lee:53 
18273165:Eric Ko:95 
18273239:Richard Ko:96 
18273475:Shawn Tornton:98 
18273427:Omar Maghardi:78 
18273975:Scott Yau:59 
18273231:Glenn Ikonomov:86 
92839115:Scott Trouchon:69 
92839985:Patric Zhou:88 
92839344:Zhanfang Li:82 
92839342:Robert Bloomingdale:91 
92839633:Patricia Garibaldi:59 
92839654:Svetlana Rusova:48 
92839443:Aleksei Titov:99 
92839864:Xiaowei Young:96 
92839428:Guan Wang:46

Can anyone help me with this.

  • Please see: [Why is “Can someone help me?” not an actual question?](http://meta.stackoverflow.com/q/284236) – EJoshuaS - Reinstate Monica Nov 06 '20 at 18:45
  • Split your problem into smaller steps. Each of those steps is already most likely asked on this site. For instance if you ask on google `java read file line by line site:stackoverflow.com` you will get many related questions like [How can I read a large text file line by line using Java?](https://stackoverflow.com/q/5868369). – Pshemo Nov 06 '20 at 18:47
  • Also don't include task information as image/link - [more info](https://meta.stackoverflow.com/a/285557) – Pshemo Nov 06 '20 at 18:48
  • Can you write answer for me I dont have experience in programming It will be great help from you! – abskjnajk Nov 06 '20 at 18:48

1 Answers1

1

While this is not a forum to answer homework questions, I can give you some pointers that will help you get started:

Things your program needs to do

To allow the user to search the file, you program must be able to:

  1. Read the user's input
  2. Read the text file
  3. (Optional) Load the data in the text file into an easy-to-search data structure
  4. Search the text file's contents (or your data structure) for the student's information

Read the user's input

This will answer that: How to get the user input in Java?

Read the text file

This will answer that: Reading a plain text file in Java

(Optional) Load data into data structure

This is optional but it will make the next step easier. You essentially need to parse the string data from the file into a data structure.

One way to do this is to create a class called Student with fields String name; , String id; and Integer score;. Then store all the students in a list like List<Student> or HashMap<String, Student> where the key is an id

Note, you can call "92839428:Guan Wang:46".split(":") for example to separate the different components on each line

Search for the student

If you create a data structure like above, you just need to find the Student object which matches the user's input

Ruben Helsloot
  • 10,555
  • 5
  • 17
  • 36
Aziz Sonawalla
  • 2,337
  • 1
  • 3
  • 6
  • Thanks alot Aziz ,Its not my homework question I am in learning phase of java and found this question and I got no clue so I just asked. – abskjnajk Nov 06 '20 at 18:54
  • I am high school student I dont know much about data structures I know about searching but how to do that in file so I am stuck.If you can write the solution it would be really great help – abskjnajk Nov 06 '20 at 18:58