[Show all top banners]

zeePa
Replies to this thread:

More by zeePa
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

paroo
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 TechGuy Help needed
[VIEWED 4883 TIMES]
SAVE! for ease of future access.
Posted on 05-09-09 11:44 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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


 
Posted on 05-10-09 1:14 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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

 
Posted on 05-10-09 4:44 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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
 
Posted on 05-10-09 6:49 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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.


 
Posted on 05-10-09 8:42 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Ok Rajmani, here you go: Why don't you just kiss my ass? How about that?!


Dorje


 
Posted on 05-10-09 10:02 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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.



 
Posted on 05-10-09 11:07 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 90 days
Recommended Popular Threads Controvertial Threads
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
TPS Re-registration case still pending ..
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Will MAGA really start shooting people?
मन भित्र को पत्रै पत्र!
Top 10 Anti-vaxxers Who Got Owned by COVID
TPS Work Permit/How long your took?
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
Breathe in. Breathe out.
3 most corrupt politicians in the world
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
emergency donation needed
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Disinformation for profit - scammers cash in on conspiracy theories
someone please tell me TPS is here to stay :(
Nas and The Bokas: Coming to a Night Club near you
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters