Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    urgent deadline today

    need help with java prgramme. using bluej to do this project. have no idea what i am doing, each time i try to compile i get errors. here is the code if anyone can help. its about a travel company who does exchanges.

    Code:
    public class NoteBundle  
    {
      private int notes;
      private double currency;
      private double rate;
    
    public NoteBundle()
    {
    
    notes =  new NoteBundle();
    }
    
      //!!!! Place the constructor(s) needed here
    
      /* Returns the note bundle's denomination. */
      public int denom( )
      { 
          
        }      
    
      /* Returns the quantity (size) of (ie, number of notes in) the note bundle. */
      public int size( )
      { }      
    
      /* Obtains the total value of the note bundle
       * (eg, a bundle of 7 notes of denomination 5 has a total value of 35)
       */
      public int totalValue( )
      { }     
    
      /* Increases the size of the note bundle by nn (>= 1) notes.
       * Throws IllegalArgumentException if nn < 1.
       */
      public void incSize(int nn)
      { }           
    
      /* Decreases the size of the note bundle by nn (>= 1) notes as follows:
       *   if nn < 1, IllegalArgumentException is thrown;
       * Otherwise the possible return values are as follows:
       *   -1: bundle size is too small for requested decrease, so no change to it has taken place
       *   0:  bundle size exactly matches the requested decrease, so it is now empty (0 in size)
       *   +1: bundle size was in excess of requested decrease, so it is still non-empty
       */
      public int decSize(int nn)
      {  }      
    
      /* For testing if the note bundle equals another.
       * The meaning of 'equals' required here is as follows:
       *   two note bundles are equal only if they are identical in both denomination and quantity.
       */
      public boolean equals(Object o)
      {  }    
    
      /* Returns a 'stringified' form of the note bundle.
       * The required form is: "d * q", where d is the bundle denomination, q the bundle size.
       * EXAMPLE: a bundle comprising 121 notes of denomination 50 has the string form "50 * 121".
       */
      public String toString( )
      { return ""; }        //!!!! REPLACE
    
      /* Maps the note bundle to an integer for 'hashing' purposes.
       * The hashcode of a note bundle is:
       *    the sum of (i) the quantity held, with (ii) 10000 * the denomination
       * EXAMPLE: a note bundle comprising 17 notes of denomination 20 has a hashcode of 200017.
       */
      public int hashCode( )
      { 
     }     
    
      }
    Last edited by WA; 04-21-2008 at 09:36 PM.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Quote Originally Posted by bluej2 View Post
    Code:
    public class NoteBundle  
    {
      private int notes;
      private double currency;
      private double rate;
    
    public NoteBundle()
    {
    
    notes =  new NoteBundle();
    }
    }
    the obvious error is that notes is declared an integer but you are trying to assign an object to it...btw this is a javascript forum not a java forum and you should seriously consider going through some java tutorials
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    New Coder
    Join Date
    Apr 2007
    Posts
    34
    Thanks
    1
    Thanked 1 Time in 1 Post
    Quote Originally Posted by shyam View Post
    btw this is a javascript forum not a java forum
    We are in CodingForums.com > :: Server side development > Java and JSP

  • #4
    Regular Coder Aradon's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    734
    Thanks
    0
    Thanked 20 Times in 19 Posts
    Quote Originally Posted by mamamia View Post
    We are in CodingForums.com > :: Server side development > Java and JSP
    Indeed, but when it was first posted it wasn't in here. It was moved by a moderator to the right forum.
    "To iterate is human, to recurse divine." -L. Peter Deutsch

  • #5
    Gox
    Gox is offline
    Regular Coder Gox's Avatar
    Join Date
    May 2006
    Location
    Ontario, Canada
    Posts
    392
    Thanks
    2
    Thanked 20 Times in 20 Posts
    All your methods that declare a return type other than "void" must return something of that type or the compiler will complain. i.e.
    public int denom( ){ } - must return an int or it won't compile.
    public int size( ){ } - must return an int or it won't compile.
    public int totalValue( ){ } - must return an int or it won't compile.
    public int hashCode( ){ } - must return an int or it won't compile.
    public boolean equals(Object o){ } - must return a boolean or it won't compile.

    Good luck with the deadline.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by Aradon View Post
    Indeed, but when it was first posted it wasn't in here. It was moved by a moderator to the right forum.
    But nothing told about the bad title
    (http://www.codingforums.com/postguide.htm)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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