VB icon

Odd and Even Numbers Using Java Spring Framework

Email
Submitted on: 5/22/2016 3:56:51 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: 974
author picture
 
     A simple program that I wrote using Java Programming language and Spring Framework to check if the given number by the user is an Odd and Even Number. Add me at Facebook my address is 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 Numbers Using Java Spring Framework
// Description:A simple program that I wrote using Java Programming language and Spring Framework to check if the given number by the user is an Odd and Even Number.
 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

TestSpringProject.java
package org.gontuseries.springcore;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestSpringProject {
 public static void main(String[] args) {
 
@SuppressWarnings("resource")
 ApplicationContext context = 
 new ClassPathXmlApplicationContext("SpringConfig.xml");
Odd_Or_Even Odd_Or_EvenObj = (Odd_Or_Even) context.getBean("Odd_Or_Even_Bean");
 
Odd_Or_EvenObj.checking();
 }
}
SpringConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="Odd_Or_Even_Bean" class="org.gontuseries.springcore.Odd_Or_Even">
</bean>
</beans>
Odd_Or_Even.java
import java.util.Scanner;
public class Odd_Or_Even {
 
 int number=0;
 
 public void checking() {
@SuppressWarnings("resource")
 Scanner in = new Scanner(System.in);
System.out.println();
System.out.println("Odd or Even Number Checker in Java Spring Framework");
System.out.println("\n");
System.out.print("Give a Number : ");
number = in.nextInt();
if ( number % 2 == 0 ) {
 System.out.println("\n");
 System.out.println("The number " + number + " is an even number.");
}
else {
System.out.println("\n");
 System.out.println("The number " + number + " is odd number.");
 }
System.out.println("\n");
System.out.println("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.