Results 1 to 3 of 3
  1. #1
    colerelm is offline Member
    Join Date
    Apr 2011
    Posts
    7
    Rep Power
    0

    Default I don't understand what I'm supposed to do...

    So today I got this programming assignment which is due in a week but I don't even understand what is being asked of me. Since my professor sucks at getting back to me via email, I have come to the internet for help.

    Create two implementations of the StringLogInterface interface as provided on [our school's website].
    One of your implementations must use an array for storage and the other must use a linked list for storage. You may not use any of the pre-defined Linked List classes, nor may you use an ArrayList.


    This was given to us on our school website:
    Java Code:
    package stringLogs;
    
    public interface StringLogInterface
    {
      void insert(String element);
      // Precondition:   This StringLog is not full.
      // 
      // Places element into this StringLog.
    
      boolean isFull();
      // Returns true if this StringLog is full, otherwise returns false.
    
      int size();
      // Returns the number of Strings in this StringLog.
    
      boolean contains(String element);
      // Returns true if element is in this StringLog,
      // otherwise returns false.
      // Ignores case differences when doing string comparison.
      
      void clear();
      // Makes this StringLog empty.
    
      String getName();
      // Returns the name of this StringLog.
    
      String toString();
      // Returns a nicely formatted string representing this StringLog.
      
      int howMany(String element);
      // Returns an int value indicating how many times element occurs
      // in the StringLog.
      
      boolean uniqueInsert(String element);
      // This method inserts element into the StringLog unless an identical
      // string already exists in the StringLog, in which case, it has 
      // no effect on the StringLog. If it does insert the string, it 
      // retuns true; otherwise it returns false. 
      
      String smallest();
      // This method returns the smallest string in the StringLog. By 
      // "smallest", we mean in terms of the lexicographic ordering
      // supported by the String class's compareTo method. As a 
      // precondition, you should assume that the StringLog is not
      // empty. 
    }
    How do I get started? I'm not asking for anyone to write my code for me, just help me get started please! Thank you.

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: I don't understand what I'm supposed to do...

    Any time you see 'identifier methodName(Args);' create a method which does what is said in the comments.

  3. #3
    DIego912 is offline Member
    Join Date
    Sep 2011
    Posts
    20
    Rep Power
    0

    Default Re: I don't understand what I'm supposed to do...

    You create a class "public class implements ArrayStringLogInterface StringLogInterface" and redefine all the methods of the interface. In these methods have redefined that you should put the logic to solve the problem of Array and LinkedList.

Similar Threads

  1. So I'm supposed to convert seconds to hours...
    By nope in forum New To Java
    Replies: 5
    Last Post: 02-14-2011, 12:46 AM
  2. small method isn't supposed to go under 0
    By senca in forum New To Java
    Replies: 2
    Last Post: 08-09-2010, 02:23 PM
  3. Values change when they're not supposed to
    By m00nchile in forum New To Java
    Replies: 7
    Last Post: 05-15-2010, 05:16 PM
  4. JButton doesn't disappear when it is supposed to?
    By ecliptical in forum New To Java
    Replies: 4
    Last Post: 01-25-2010, 01:41 AM
  5. Help interpreting what a class is supposed to do
    By bornwithnoname in forum New To Java
    Replies: 2
    Last Post: 11-20-2008, 01:19 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
  •