...

View Full Version : urgent deadline today



bluej2
04-21-2008, 12:05 PM
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.


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( )
{
}

}

shyam
04-21-2008, 12:50 PM
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

mamamia
04-22-2008, 06:18 PM
btw this is a javascript forum not a java forum

We are in CodingForums.com > :: Server side development > Java and JSP :)

Aradon
04-22-2008, 08:39 PM
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.

Gox
04-27-2008, 07:42 AM
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.

abduraooft
04-27-2008, 01:52 PM
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) :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum