1. Quit (exit the program) 2. Add (to the ArrayList) all the marks information about a coursework or research student by reading it from another text file and determine the student's overall mark and grade. You will need to consider how to deal with the different assessment components for the coursework and research students. You may use two different text files, one for coursework students and another for research students. The program should read the correct text file for this purpose. 3. Given student number (ID), remove the specified student and relevant information from the ArrayList. It is always good to ask the user to confirm again before removing the record. For confirmation, output the student number (ID) and the name to the user. 4. Output from the ArrayList the details (all information including the overall mark and the grade) of all students currently held in the ArrayList. 5. Compute and output the overall mark and grade for coursework or research students 6. Determine and display how many coursework or research students obtained an overall mark equal to or above the average overall mark and how many obtained an overall mark below the average overall mark 7. Given a coursework or research student number (ID), view all details of the student with that number. If the student is not found in the ArrayList, an appropriate error message is to be displayed 8. Given a coursework or research student’s name (both surname and given name – ignoring case), view all details of that student. If the student is not found in the ArrayList, an appropriate error message is to be displayed. If more than one student having the same name, display all of them. Sort the ArrayList of the student objects into ascending order of the students' numbers (IDs), and output the sorted array - implement an appropriate sorting algorithm for this, and explain why such algorithm is selected (in internal and external documentation). 10. Output the sorted ArrayList from (9) to a CSV file. If the ArrayList is not sorted, this option cannot be selected. te that the program will loop around until the user selects the first option (Quit).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

import java.io.*;
import java.util.*;

public class Client {

private ArrayList<Student> students;
private String dealWithType;


public Client() {
students = new ArrayList<Student> ();
dealWithType = "coursework";
dealWithType = "research";
readStudent();
readResult();
}

public void run() {
for(Student s : students) {
s.display();
System.out.println();
}
}

private void readResult() {

for(Student s : students) {
try {
String data = getResultData(s.getId());
if(data.equals("")) {
throw new StudentNotFoundException(s.getId());
}
s.setData(data);
}catch(StudentNotFoundException ex){
System.out.println(ex);
System.out.println();
}
}
}

private String getResultData(long id) {

String toReturnLine = "";
try {
Scanner file = new Scanner(new File(dealWithType+".csv"));
// read in header and throw away
file.nextLine();
while (file.hasNextLine()) {
String line = file.nextLine();
String[] data = line.split(",");
long studentID = Long.parseLong(data[0]);
if(studentID == id) {
toReturnLine = line;
break;
}
}
file.close();
}catch(FileNotFoundException ex) {
System.out.println("students.csv File not found");
}
return toReturnLine;
}



private void readStudent(){

students.clear();

try {
Scanner file = new Scanner(new File("students.csv"));
// read in header and throw away
file.nextLine();

while (file.hasNextLine()) {

String line = file.nextLine();
String[] data = line.split(",");
String type = data[0];
String title = data[1];
String firstName = data[2];
String lastName = data[3];
long studentID = Long.parseLong(data[4]);
int dbMonth = Integer.parseInt(data[5]);
int dbDay = Integer.parseInt(data[6]);
int dbYear = Integer.parseInt(data[7]);

if(type.equals("coursework") && dealWithType.equals("coursework")) {
CourseWorkStudent cw = new CourseWorkStudent(title, firstName, lastName, studentID, dbDay, dbMonth, dbYear,type);
students.add(cw);
}else if(type.equals("research") && dealWithType.equals("research")) {
ResearchStudent r = new ResearchStudent(title, firstName, lastName, studentID, dbDay, dbMonth, dbYear,type);
students.add(r);
}
}

}catch(FileNotFoundException ex) {
System.out.println("students.csv File not found");
}
}

public static void main(String[] args) {
new Client().run();

}

}

I am required to load a file name students into the program and after doing this code, I have an error that says "students.csv File not found". And I also have to make a menu like the one requested in the 2nd image. please help!

 

1. Quit (exit the program)
2. Add (to the ArrayList) all the marks information about a coursework or research student by
reading it from another text file and determine the student's overall mark and grade.
You will need to consider how to deal with the different assessment components for the
coursework and research students. You may use two different text files, one for coursework
students and another for research students. The program should read the correct text file for
this purpose.
3. Given student number (ID), remove the specified student and relevant information from the
ArrayList. It is always good to ask the user to confirm again before removing the record. For
confirmation, output the student number (ID) and the name to the user.
4. Output from the ArrayList the details (all information including the overall mark and the
grade) of all students currently held in the ArrayList.
5. Compute and output the overall mark and grade for coursework or research students
6. Determine and display how many coursework or research students obtained an overall mark
equal to or above the average overall mark and how many obtained an overall mark below the
average overall mark
7. Given a coursework or research student number (ID), view all details of the student with that
number. If the student is not found in the ArrayList, an appropriate error message is to be
displayed
8. Given a coursework or research student's name (both surname and given name – ignoring
case), view all details of that student. If the student is not found in the ArrayList, an
appropriate error message is to be displayed. If more than one student having the same name,
display all of them.
9.
Sort the ArrayList of the student objects into ascending order of the students' numbers (IDs),
and output the sorted array - implement an appropriate sorting algorithm for this, and explain
why such algorithm is selected (in internal and external documentation).
10. Output the sorted ArrayList from (9) to a CSV file. If the ArrayList is not sorted, this option
cannot be selected.
Jote that the program will loop around until the user selects the first option (Quit).
et up a student ArrayList of N student objects, and test it with N = 10 (at least). You have to
tore vour test data in a file so that vour program can read them
Transcribed Image Text:1. Quit (exit the program) 2. Add (to the ArrayList) all the marks information about a coursework or research student by reading it from another text file and determine the student's overall mark and grade. You will need to consider how to deal with the different assessment components for the coursework and research students. You may use two different text files, one for coursework students and another for research students. The program should read the correct text file for this purpose. 3. Given student number (ID), remove the specified student and relevant information from the ArrayList. It is always good to ask the user to confirm again before removing the record. For confirmation, output the student number (ID) and the name to the user. 4. Output from the ArrayList the details (all information including the overall mark and the grade) of all students currently held in the ArrayList. 5. Compute and output the overall mark and grade for coursework or research students 6. Determine and display how many coursework or research students obtained an overall mark equal to or above the average overall mark and how many obtained an overall mark below the average overall mark 7. Given a coursework or research student number (ID), view all details of the student with that number. If the student is not found in the ArrayList, an appropriate error message is to be displayed 8. Given a coursework or research student's name (both surname and given name – ignoring case), view all details of that student. If the student is not found in the ArrayList, an appropriate error message is to be displayed. If more than one student having the same name, display all of them. 9. Sort the ArrayList of the student objects into ascending order of the students' numbers (IDs), and output the sorted array - implement an appropriate sorting algorithm for this, and explain why such algorithm is selected (in internal and external documentation). 10. Output the sorted ArrayList from (9) to a CSV file. If the ArrayList is not sorted, this option cannot be selected. Jote that the program will loop around until the user selects the first option (Quit). et up a student ArrayList of N student objects, and test it with N = 10 (at least). You have to tore vour test data in a file so that vour program can read them
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY