Results 1 to 4 of 4
  1. #1
    Lifeis2evil's Avatar
    Lifeis2evil is offline Member
    Join Date
    Nov 2008
    Posts
    3
    Rep Power
    0

    Unhappy Need helps making counter

    I need to create a new class named Counter which represents a positive value that may range from zero to some maximum and when incremented past the maximum, reverts to zero. Provide a string representation that shows leading zeros. Test your design with the JUnit test provided.

    and have to use these:
    increment() method works (“rolls over” to 0)
    decrement() method works (“rolls over to max)
    setValue() method works as specified
    toString() method works as specified


    I don't know how to do it :[ I'm stuck doing other projects but missing a lot so failing,,, Please please please help meee :[ :(

    I attached the files in a .zip
    Attached Files Attached Files

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    I don't understand,you don't know how to do that,but you know how to make JUnit test case,as i saw in the zip file.How can it be?

  3. #3
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Should you create the class according to the TestCase class?

  4. #4
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Java Code:
    public class Counter
    {
       int counter=0;
       int limit;
       public Counter(int max)
    {
       limit = max;
    }
    boolean checkMax(){
       if( counter > max) counter =0;
    }
    I hope you are not as evil as your screen names sounds, I take my evil weevils to town on Friday Night to Boogie....

    What are you missing? Where did you get code telling you to format with leading zeros if you are missing too mucy?

    If you are this far behind and being assigned code to do decimal formatting your are basically toe-on at the last edge of oblivion, better ask for your old job back flippin burgers or ( based on your avatar ) jockeying vinyl.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. Frequency Counter
    By justlearning in forum New To Java
    Replies: 0
    Last Post: 05-07-2008, 11:50 PM
  2. [SOLVED] BST Frequency Counter
    By theonly in forum Advanced Java
    Replies: 7
    Last Post: 04-30-2008, 12:33 AM
  3. Making triangle
    By banie in forum New To Java
    Replies: 4
    Last Post: 02-02-2008, 12:23 PM
  4. Help with making this algorithm better
    By RLRExtra in forum New To Java
    Replies: 6
    Last Post: 01-17-2008, 05:11 PM
  5. Help with static variable counter
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-19-2007, 08:53 PM

Posting Permissions

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