wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Help needed in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help needed in Java" Watch "Help needed in Java" New topic
Author

Help needed in Java

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

I have a clarification in java.

Requirement:
1>Write a method in java such that it returns a number between 0 and 3 ?
2>Using the same above method as defined in step#1,generate a number between 0 and 7 ?

Please help me out to solve this .

--
Deepak Lal


When The Going Gets Tougher,The Tougher gets Going
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Please help me out to solve this .

What do you have so far ? (please read this)


[My Blog]
All roads lead to JavaRanch
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39810
    
  28
Christophe Verré wrote:(please read this)
And this. And this.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

HI campbell and christophe,
i read your link.but i dont know how to proceed for this particualar problem.could you guide me please.?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14342
    
  22

A method in Java that returns a number between 0 and 3:

Or is there more to the assignment than this? Did you mean a random number between 0 and 3? If so, then have a look at the API documentation for class java.lang.Math. It contains a method to generate random numbers. Or look at the documentation of class java.util.Random.

It sounds like a very simple exercise. Can explain in more detail what you don't understand about it?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Here is a part from this page that I'd like to draw your attention to :
We would much rather see you post your own code, working or not, and give you tips to help you get it working or point you toward resources that will help you to learn how to solve your problem using best practices.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Ok,
i will post my code and then please guide me to resolve it.
Thanks everyone.

--
Deepak Lal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed in Java