Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class named Student that includes String data fields for firstName and

ID: 3545159 • Letter: C

Question

Create a class named Student that includes String data fields for firstName and lastName.  Create a constructor that requires two String parameters to populate the firstName and lastName fields.  Create a LinkedList of 20 Student objects each having different first and last names.  Print your LinkedList, first in the order your items were placed onto the LinkedList and then in reverse order.  Save your files as Student.java and ClassRoster.java.

Compile and run your programs until it works and the output looks nice. Add the necessary documentation as described in Course Documents, and then attach your .java files to this assignment. Do not attach the .class files, attach only the Java source code.

Explanation / Answer

Sample Output





Printing the names in the order as they are entered

First name=Mark, Last name=Anderson

First name=Paul, Last name=Walker

First name=Vin, Last name=Diesel

First name=Bill, Last name=Gates

First name=Sara, Last name=Tancredi

First name=Carlos, Last name=Slim Helu

First name=Warren, Last name=Buffet

First name=Paris, Last name=Hilton

First name=Angelina, Last name=Jollie

First name=Brad, Last name=Pitt

First name=Larry, Last name=Ellison

First name=David, Last name=Koch

First name=Mark, Last name=Waugh

First name=Kevin, Last name=Peterson

First name=James, Last name=William

First name=Ruby, Last name=Parera

First name=Sachin, Last name=Tendulkar

First name=Jaques, Last name=Kallis

First name=Shane, Last name=Warne

First name=David, Last name=Bekham



Printing the list contents after reversing the list

First name=David, Last name=Bekham

First name=Shane, Last name=Warne

First name=Jaques, Last name=Kallis

First name=Sachin, Last name=Tendulkar

First name=Ruby, Last name=Parera

First name=James, Last name=William

First name=Kevin, Last name=Peterson

First name=Mark, Last name=Waugh

First name=David, Last name=Koch

First name=Larry, Last name=Ellison

First name=Brad, Last name=Pitt

First name=Angelina, Last name=Jollie

First name=Paris, Last name=Hilton

First name=Warren, Last name=Buffet

First name=Carlos, Last name=Slim Helu

First name=Sara, Last name=Tancredi

First name=Bill, Last name=Gates

First name=Vin, Last name=Diesel

First name=Paul, Last name=Walker

First name=Mark, Last name=Anderson










Code



//FIRST CLASS IS Student.java



public class Student {

String firstName;

String lastName;


//constructor as mentioned in the question

public Student(String firstName, String lastName) {

super();

this.firstName = firstName;

this.lastName = lastName;

}


//toString method to print the details

public String toString() {

return "First name=" + firstName + ", Last name=" + lastName;

}



}


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote