jQuery in Action, 2nd edition*
The moose likes Cattle Drive and the fly likes Say 4b Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Say 4b" Watch "Say 4b" New topic
Author

Say 4b

Ellen Smith
Greenhorn

Joined: Mar 01, 2001
Posts: 7
Are we supposed to be using all integers for this assignment? I am having a problem and don't know what to do. If I use integers, when I put in digits greater than 32,728 or so, my program bombs. But if I use all longs, when I do modulus arithmetic in the method I used in my first assignment, that won't work either. Any suggestions as to what I am doing wrong. I am really getting desperate. Thanks for any help I can get....
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
ellen, i am using a long to start the program, but then i cast to an int when i need to... something like this:
int newNumber = (int)( longValue / intValue );
i also use some math to change the value of the long without the cast... that looks something like this:
longValue = longValue % intValue ;
i hope this helps! btw, i haven't passed 4b yet, but my nitpicks haven't been about my casting so i guess this is okay.
also, if i gave too much away please tell me so i can delete this!
[This message has been edited by Greg Harris (edited June 19, 2001).]


what?
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
I think this sort of help should be allowed, to really find out
this sort of knowledge yourself is not necessary. Learning from examples is very good too, IHMO (in my humble opinion) ;-)
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Greg the basic rule is : "if you don�t post actual code you�re OK".
There are however exceptions.
  • If the objective of an assignment is to find a specific class in the SDK, well don�t mention THE CLASS !!!
  • Also if the instructors solution is pretty neat or unique pse don�t let the others still doing the assignment know about it.

  • Thanks
    ps If I think you give away anything I'll delete it
    [This message has been edited by Johannes de Jong (edited June 20, 2001).]
Ellen Smith
Greenhorn

Joined: Mar 01, 2001
Posts: 7
Well thanks for all your help. I'll try ANYTHING just about now just to say sane.
[This message has been edited by Ellen Smith (edited June 20, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Say 4b
 
Similar Threads
Help Java 4b ???
how to read integers from keyboard?
could someone explain stringTokenizer
Developing editor
Extracting integers from strings