Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java and plz use studentlist and code tester thank you! public interface StudentList { /* * Purpose: adds Student s to back of this list

Java and plz use studentlist and code tester thank you!

image text in transcribed

public interface StudentList { /* * Purpose: adds Student s to back of this list * Parameters: Student - s * Returns: nothing */ public void add(Student s); /* * Purpose: returns the number of elements in this list * Parameters: none * Returns: int - the number of elements */ public int size(); /* * Purpose: returns a String reprensentation of the elements * in this list separated by newlines * Parameters: none * Returns: String - the representation */ public String toString(); /* * Purpose: removes the first element in the list * Parameters: none * Returns: nothing */ public void removeFront(); /* * Purpose: determines whether a Student which is equivalent to s * is contained in this list * Parameters: Student - s * Returns: boolean - true if a Student matching s is found, * false otherwise */ public boolean contains(Student s); } public static void testNode() { Student s0 = new Student("abc", 50); Student s1 = new Student("def", 56); Student s2 = new Student("xyz", 99); Student s2b = new Student("xyz", 29); StudentNode n0 = new StudentNode(s0); // must use == to determine whether they are the SAME object, // .equals will tell us if they are equivalent sIDs displayResults(n0.getData() == s0, "test contructor 1 arg with getData"); displayResults(n0.getNext() == null, "test contructor 1 arg with getNext"); StudentNode n1 = new StudentNode(s1, n0); displayResults(n1.getData() == s1, "test contructor 2 args with getData"); displayResults(n1.getNext() == n0, "test contructor 2 args with getNext"); StudentNode n2 = new StudentNode(s2, n1); displayResults(n2.getData() == s2, "test contructor 2 args with getData"); displayResults(n2.getNext() == n1, "test contructor 2 args with getNext"); displayResults(n2.getNext().getNext() == n0, "test contructor 2 args with getNext"); n2.setData(s2b); displayResults(n2.getData() == s2b, "test setData with getData"); n2.setData(s1); displayResults(n2.getData() == s1, "test setData with getData"); n2.setNext(n0); displayResults(n2.getNext() == n0, "test setNext with getNext"); displayResults(n2.getNext().getNext() == null, "test setNext with getNext"); }

* Purpose: returns the number of elements in this list * Parameters: none * Returns: int - the number of elements */ public int size(); * Purpose: returns the number of elements in this list * Parameters: none * Returns: int - the number of elements */ public int size()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Where do you see yourself in 5 years?

Answered: 1 week ago

Question

CS homework question

Answered: 1 week ago

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago