Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > Webmaster Forums > Web Design, Coding & Programming Forum

GoogleCommunity Sponsor
Cirtex Hosting
Use coupon "forum" for 50% Off!

Reply
 
LinkBack Thread Tools Display Modes
Old 10-19-2007, 07:29 PM   #1 (permalink)
Noogle
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
tenzuu is on a distinguished road
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.
tenzuu is offline   Reply With Quote
 
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -8. The time now is 11:57 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community