144k views
2 votes
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.

User Filbranden
by
5.3k points

1 Answer

5 votes

Answer:

public class ArithmeticMethods

{

public static void main(String[] args) {

int number1 = 7;

int number2 = 28;

displayNumberPlus10(number1);

displayNumberPlus10(number2);

displayNumberPlus100(number1);

displayNumberPlus100(number2);

displayNumberPlus1000(number1);

displayNumberPlus1000(number2);

}

public static void displayNumberPlus10(int number){

System.out.println(number + 10);

}

public static void displayNumberPlus100(int number){

System.out.println(number + 100);

}

public static void displayNumberPlus1000(int number){

System.out.println(number + 1000);

}

}

Step-by-step explanation:

Inside the main:

Initialize two integers, number1 and number2

Call the methods with each integer

Create a method called displayNumberPlus10() that displays the sum of the given number and 10

Create a method called displayNumberPlus100() that displays the sum of the given number and 100

Create a method called displayNumberPlus1000() that displays the sum of the given number and 1000

User Keisha
by
5.7k points