Question: 7.2.9 Teacher Class List Methods ctice Op Hun Step Check Code Continue Connected 7.2.9 Teacher Class List Methods Submit Continue 1 public class ClassListTester 2.1

7.2.9 Teacher Class List Methods
7.2.9 Teacher Class List Methods ctice Op Hun Step Check Code Continue
Connected 7.2.9 Teacher Class List Methods Submit Continue 1 public class ClassListTester
2.1 3 public static void main(String args) 4. { //You don't need

ctice Op Hun Step Check Code Continue Connected 7.2.9 Teacher Class List Methods Submit Continue 1 public class ClassListTester 2.1 3 public static void main(String args) 4. { //You don't need change anything here, but feel free to add more Students! Student alan - new Student("Alan", 11); Student kevin = new Student("Kevin". 10): Student annie = new Student(Annie", 12): System.out.println(Student.printClassListo): 10 11 System.out.println(Student.getLast Student); 12 System.out.println(Student.getStudent()); Student.addStudent(2, new Student("Trevor", 12)); System.out.println(Student.printClassListo): System.out.println(Student.getClassSize(): ; Secare Cup A Chuck Code caminte 7.2.9 Teacher Class List Methods 1 teport java.util.ArrayList; 2 3 public class Student 4- 5 private String name; 6 private int grade: 7 // Implement classlist here private static ArrayList Student classlist = new ArrayList Student 10 public Student(string nome, int grade) 11 { 12 this.namenom 13 this.grade grade; 14 classList.add(this); 15 16 17 public String getNome 18 19 return this.nome: ) V/Add the static methods here: INNESOREN public static String printClassListo String names: for(Student name: classlist) names nome.getName": 1 return "Student Class List:\"nones, Resume BRODY CLAYTON Continue Save Output Test Cases Docs Anment Grade ME 5 points Status: Not Submitted Now that the classList Array has been implemented, we need to create methods to access the list items Create the following static methods for the Student class 3 PG 1. getLast Studento) - returns the name of the last student in the classlist array 2.getClassSize() - returns the size of the classlist 3. addStudent(int index, Student student) - adds a new student to the classlist at index index The method is a little tricky - When the new Student is added to the class will create a duplicate value at the end of the classList because of our student constructor. This method should also include a command to remove the extra Student in the classList added to the end 4. getStudentfint index) - returns the name of a student at the index specified pd 372 df

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!