VB icon

Odd and Even Number Using Method in Java

Email
Submitted on: 10/5/2016 2:58:07 AM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 1422
author picture
 
     A program that I wrote using Java that uses method to check if the given number is an odd or even. The code is very short and easy to understand. Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Odd and Even Number Using Method in Java
// Description:A program that I wrote using Java that uses method to check if the given number is an odd or even. The code is very short and easy to understand.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 
My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

// Problem : Write a program in Java that will check if the given number by the user is an
//Odd or Even Number. 
// Date: June 28, 2015
// Written By: Mr. Jake R. Pomperada, MAED-IT
// Email Address: jakerpomperada@yahoo.com and jakerpomperada@gmail.com
import java.util.Scanner;
class odd_even_checker {
 
public int check_odd_even_number(int value)
 {
 if((value % 2) == 0) 
System.out.println("The given number is " + value + " is Even Number.");
 
 else
System.out.println("The given number is " + value + " is Odd Number.");
return 0;
}
 
public static void main(String args[]) {
 Scanner scan = new Scanner(System.in);
char a;
do
{
 // creating of an object
 
 odd_even_checker num = new odd_even_checker();
 
 System.out.println();
 System.out.println("===== ODD OR EVEN NUMBER CHECKER =====");
 System.out.println();
 System.out.print("Enter a Number : ");
 int number_given =scan.nextInt();
 
 System.out.println();
 num.check_odd_even_number(number_given);
 System.out.println("\n\n");
 System.out.print("Do you Want To Continue (Y/N) :=> ");
a=scan.next().charAt(0);
} while(a=='Y'|| a=='y');
 System.out.println("\n");
 System.out.println("\t ===== END OF PROGRAM ======");
 System.out.println("\n");
 }
 
} // End of Program


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.