iSay_copro2_change
Posted by donabel malagamba on Friday, July 8, 2011
Under: Copro2
import javax.swing.*;
public class Numbers{
public static void main (String[]args){
int value1 =0;
int value2 =0;
int sum =0;
int difference=0;
value1=getValue1(value1);
value2=getValue2(value2);
sum=getSum(value1,value2);
difference=getDifference(value1,value2);
System.out.println ("The sum of " +value1+"+"+value2+"=" + sum);
System.out.print ("The difference of " +value1+"+"+value2+"="+ difference);
}
public static int getValue1 (int value1){
int a=setValue1 (value1);
return a;}
public static int setValue1 (int value1){
String a= JOptionPane.showInputDialog ("Enter the first value");
int b= Integer.parseInt (a);
return b;}
public static int getValue2 (int value2){
int c=setValue2 (value2);
return c;}
public static int setValue2 (int value2){
String c= JOptionPane.showInputDialog ("Enter the second value");
int d= Integer.parseInt (c);
return d;}
public static int getSum (int value1,int value2){
int x= setSum (value1,value2);
return x;}
public static int setSum (int value1,int value2){
int a= value1 + value2;
return a;}
public static int getDifference (int value1,int value2){
int y= setDifference (value1,value2);
return y;}
public static int setDifference (int value1,int value2){
int b= value1-value2;
return b;}
public static void main (String[]args){
int value1 =0;
int value2 =0;
int sum =0;
int difference=0;
value1=getValue1(value1);
value2=getValue2(value2);
sum=getSum(value1,value2);
difference=getDifference(value1,value2);
System.out.println ("The sum of " +value1+"+"+value2+"=" + sum);
System.out.print ("The difference of " +value1+"+"+value2+"="+ difference);
}
public static int getValue1 (int value1){
int a=setValue1 (value1);
return a;}
public static int setValue1 (int value1){
String a= JOptionPane.showInputDialog ("Enter the first value");
int b= Integer.parseInt (a);
return b;}
public static int getValue2 (int value2){
int c=setValue2 (value2);
return c;}
public static int setValue2 (int value2){
String c= JOptionPane.showInputDialog ("Enter the second value");
int d= Integer.parseInt (c);
return d;}
public static int getSum (int value1,int value2){
int x= setSum (value1,value2);
return x;}
public static int setSum (int value1,int value2){
int a= value1 + value2;
return a;}
public static int getDifference (int value1,int value2){
int y= setDifference (value1,value2);
return y;}
public static int setDifference (int value1,int value2){
int b= value1-value2;
return b;}
}
In : Copro2