Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q.. Create an application named ArithmeticMethods whose main() method holds two

ID: 3542367 • Letter: Q

Question

Q.. Create an application named ArithmeticMethods whose main() method holds
two integer variables. Assign values to the variables. In turn, pass each value to
methods named displayNumberPlus10(), displayNumberPlus100(), and
displayNumberPlus1000(). Create each method to perform the task its name
implies. Save the application as ArithmeticMethods.java.

Q..Modify the ArithmeticMethods class to accept the values of the two integers from

a user at the keyboard. Save the file as ArithmeticMethods2.java.

Explanation / Answer

part(a)

public class ArithmeticMethods{

  

public static void displayNumberPlus10(int a)

{

System.out.println(a+" + 10 : "+(a+10));

}

public static void displayNumberPlus100(int a)

{

System.out.println(a+" + 100 : "+(a+100));

}

public static void displayNumberPlus1000(int a)

{

System.out.println(a+" + 1000 : "+(a+1000));

}


  

  

  

public static void main(String []args){

int a=20;

int b=10;

System.out.println("First number is :"+a);

System.out.println("Second number is :"+b);

  

displayNumberPlus10(a);

displayNumberPlus10(b);

displayNumberPlus100(a);

displayNumberPlus100(b);

displayNumberPlus1000(a);

displayNumberPlus1000(b);

}

}