|
||||||||||
|
|||||||
| GoogleCommunity Sponsor |
Use coupon "forum" for 50% Off! |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Noogle
![]() Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
HELP! with Java Programming
I cannot seem to figure out methods, i have to write this program but i am lost in the methods. Here is the question on the program.
/*Create a simple Java program to generate a random number that is smaller than 100 and divide the number by 2. If the number is an odd number, display a message that this number is an odd number. Otherwise, display this number is an even number. Use the above different types of method to develop this program. public void displayResult(String) public boolean isEvenNumber(int) public int getNextNumber() public void execute() public static void main() */ This is what i have so far............ ************************************************** ************************* import java.util.*; public class Assignment6{ public static void main(String args[]){ Assignment6 myAssignment6 = new Assignment6(); Assignment6.execute(); } public void execute(){ Random randomNumbers = new Random(100); int generateNum = randomNumbers.nextInt(); System.out.println("\n\n\nThe number generated is " + generateNum); if (generateNum % 2 == 0){ System.out.println("The number generated is an even number"); } else{ System.out.println("The number generated is an odd number"); } } ************************************************** ********************* Any help would be greatly appreciated. Thanks in advance. |
|
|
|
|
Sponsored Links
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Web programming question. | Endante | Web Design, Coding & Programming Forum | 6 | 03-23-2006 11:26 AM |
| "Java Is Dead, Long Live Java!" | geekerati | General Discussion | 0 | 01-13-2006 11:57 PM |
| Game Programming | JoeSSJ4 | General Discussion | 8 | 04-30-2005 10:07 AM |
| Pocket pc programming help!!! | Paul123 | General Computer Forum | 0 | 01-22-2005 09:57 AM |