Hey TechGuys out there i am trying learn java data structures, LinkedList class and i am simply not getting anything. Can anyone shed some light on how to solve this problem with explanation commented as each code goes thru.. There has to be a class named Student that includes String data fields for firstName and lastName. There has to be a constructor that requires two String parameters to populate the firstName and lastName fields. There has to be a List of 20 Student objects each having different first and last names. Finally Print LinkedList, first in the order your items were placed onto the LinkedList and then in reverse order. Required files to be saved as Student.java and ClassRoster.java. Dorje
zeepa · May 9, 2009 11:44 PM · 12,358 views
haina ho sajha ma gan than bhanda pani homework sodne dherai huna thale, kta haru padne bela ma ghanta hanna besta chaan ani homework bujhaune bela ayepachi aru lie sodhna thalchaan, baru nepal nai gaye bhai halyo ni yo bhanda ta...khitiii khitiii khitiii khitiii haas uthchaa bhanya
rajmani · May 10, 2009 1:14 AM
public class Student { String firstName; String lastName; Student(String fName, String lName) { firstName = fName; lastName = lName; } void display() { System.out.println(firstName); System.out.println(lastName); } } import java.util.LinkedList; public class ClassRoster { static void orderPrint(LinkedList l) { int size = l.size(); for(int i=0; i < size; i++) { Student s =(Student) l.get(i); s.display(); } } static void reverseOrderPrint(LinkedList l) { int size = l.size(); for(int i=size-1;i>=0;i--) { Student s =(Student) l.get(i); s.display(); } } public static void main(String args[]) { //Get 20 students information using loop //I've used only two objects for the example Student s1 = new Student("AA","BB"); Student s2 = new Student("CC","DD"); LinkedList l = new LinkedList(); l.add(s1); l.add(s2); // End of inputs orderPrint(l); reverseOrderPrint(l); } } Let me know if u didnt understand any part
techGuy · May 10, 2009 4:44 AM
Rajmani bro, Hasayo rajmani bro le pani. Timi sarai narrow-minded person raichau bro..look at techguy..if someone is asking for help, i would rather help than leave such funny comments. Let me know if i can help you in any aspects of your life...And Million thanks to Techguy. He who listens to others plead will never have to plead coz god will listen to him all the time...Thank you, gentleman! Dorje.
zeePa · May 10, 2009 6:49 AM
Ok Rajmani, here you go: Why don't you just kiss my ass? How about that?! Dorje
zeePa · May 10, 2009 8:42 AM
Zeepa (Dorje) bro le balla yo rajmani bhanne sano bichar bhako manche lai chup lagayo. Rajmani bro timi ta professor le bujhako ta sabai bujda rahechau tyehi bhayera timile SLC ma board first haneko hola, ani US pani scholarship ma ako hola ani timi ta yaha ghanta na hani basirako chau haina???? saathi nabujheko kura sabaile sodhna pauchan it doesn't matter whether it is in sajha or any other website. ra ramro bichar bhako TECHGUY jasto manche lai chai HATSOFF.
dharanstar · May 10, 2009 10:02 AM
Dharanstar, Hats off to ya to for positively taking it. Thanks bro. Rajmani and people with attitude like his should go to mexico and mow some mexican yards in summer. Dorje
zeePa · May 10, 2009 11:07 AM
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion