The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

java help needed urgently :(

Write a program that generates random numbers:
a) Write a method that returns a random integer in the range of 1 to 100.
b) Then add another method that takes a parameter specifying the top number – i.e. if you pass it 50 it returns a random number between 1 and 50. Test your random method and make sure it works.
c) Write another method so that you pass it two values – the top and bottom of the range you want the highest value from – i.e. if you pass it 10 and 20 it returns a random number between 10 and 20.
d) Then write another method so that if repeatedly called it doesn’t return two numbers the same? So once a random number has been generated and returned, the method doesn’t return that number again. To do this you will have to store every number generated.
Do each method in turn and then test that it works by calling it from the main method (I don’t mean write a test plan), again no need for user input. So you should end up with a single class (the main can go in it) with four other methods – each one implementing the functionality described above.