Results 1 to 7 of 7
  1. #1
    Roshi is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Exclamation Help with UNI tasks

    sorry i didn't know. the first question is to convert the ADT to a generic type.

    Would the following be an example of changing it to generic. e.g.

    //original coding


    public interface SetADT
    {
    // Adds one element to this set
    public void addElement (Object element);
    }

    ----------------------------------------------------------
    //Attempt at generic

    public interface SetADT <T>
    {
    // Adds one element to this set
    public void T add (T e);
    }

    that anywhere near it or am i completely wrong?

    sorry again!
    Last edited by Roshi; 10-26-2010 at 02:25 PM.

  2. #2
    m00nchile is offline Senior Member
    Join Date
    Feb 2010
    Location
    Ljubljana, Slovenia
    Posts
    470
    Rep Power
    5

    Default

    Posting an assignment list and asking for code is not a good way to get help around here. Show us what you've attempted and ask more specific questions, you'll find a lot of people who are willing to help here if you show some effort.
    Ever seen a dog chase its tail? Now that's an infinite loop.

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default

    Uninformative title, typos, SMS-speak, complaining about your situation, linking somewhere else to get to any actual information, not asking a question, requesting "the codes", homework dumping, asking somebody else to do your homework and email it back, and complaining about your deadlines.

    Congratulations, you've managed to break just about every rule about not annoying your would-be helpers, all in a single post. Well done.

    How To Ask Questions The Smart Way

  4. #4
    Roshi is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Default

    edited the 1st post. sorry

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default

    Quote Originally Posted by Roshi View Post
    that anywhere near it or am i completely wrong?
    What happened when you threw together an example that uses it? What happened when you tried to compile it?

  6. #6
    Roshi is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Default

    to be honest i wouldn't even be able to do that lol. I just have to convert it to a generic typed ATD. I was messing about and am thinking either . . . .

    public interface SetADT <T>
    {
    // Adds one element to this set
    public T add(T e);

    or

    public void add(T e)

    Would that work and the other work if i was wanting to return an object of "T". it doesn't specify if i need to, i just need to convert an abstract of code to a generic type.

  7. #7
    bayan is offline Member
    Join Date
    Apr 2010
    Posts
    55
    Rep Power
    0

    Default

    I remember when I gave someone code for his homework once. Got around 3 flames in response. Guys go easy on new people to these forums they don't know how it works.

Similar Threads

  1. project with 5-6 java (and a bit xml) tasks
    By nortelnet in forum Jobs Offered
    Replies: 2
    Last Post: 08-18-2008, 07:38 AM
  2. Scheduling tasks using Threads
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •