Interview Question for Java Developers
- -1of 1 vote
The input is being read in from a file called input.txt, in this format: 22|Data Structures|45- nik April 01, 2016 in India
Each line consists of three fields "Student ID," "Subject," and "Marks." "Student ID" and "Marks" are integers and "Subject" is a string that does not contain '|' or newlines. There can be any number of students and up to 6 subjects. The fields are separated by the '|' character.
Currently, the existing program reads the input and creates an ArrayList<String> from the lines of input. Then it calls a method processData on this ArrayList, and prints the returned data to the output file. Unfortunately, processData currently does not do anything useful - it just returns an empty `Map.
You have to modify processData to compute the marks scored in each subject by the student with the lowest ID (who has actually appeared for that test). Thus, processData will returns a Map that maps each Subject to the marks scored. In other words, the map will contain each subject name as a key, and the marks scored by the student with the lowest ID as the value for that entry.
If your program is run with the input given above, it should produce the following output:
Data Structures: 45
Please read this expected output carefully to understand exactly what you're expected to compute.
Plz help me solve urgent.
| Report Duplicate | Flag | PURGE
Java Developer Java
Open Chat in New Window