Assignment: #arithmetic Due: 02/10/02019 Points: 3

### Specification

Write an interactive application that uses Java's arithmetic operators.

Create a new file for this program. The following should be the first statement inserted into your file.

```   import java.util.Scanner;
```

Declare a class named Arithmetic.

```   public class Arithmetic
{
public static void main(String[] argv)
{
/* replace this comment with your code */
}
}
```

Define and instantiate a class Scanner object in order to get input from the standard input stream.

Prompt the user to enter an integer number.

Define a variable of type int and user the Scanner object to read the integer from the standard input stream.

```   Scanner scanner = new Scanner(System.in);
System.out.print("Enter an integer: ");
int n = scanner.nextInt();
```

The program uses the user entered input to print the following in the order listed. [Note: n is the input, while y and z store values that are calcuated using n.]

```   the opposite of n is y
n doubled is y
one-half of n is y
n squared is y
the reciprocal of n is y
one-tenth of n is y and y squared is z
n minus the last digit of n is y
the sum of n and n+1 and n+2 is y
```

This program requires the use of all five arithmetic operators: add (+), subtract (-), multiply (*), divide (/), and modulus (%).

Example runs for the inputs 37, 101, -42, 3141592.

```Enter an integer: 37
the opposite of 37 is -37
37 doubled is 74
one-half of 37 is 18.5
37 squared is 1369
the reciprocal of 37 is 0.02702702702702703
one-tenth of 37 is 3.7 and 3.7 squared is 13.690000000000001
37 minus the last digit of 37 is 30
the sum of 37 and 38 and 39 is 114

Enter an integer: 101
the opposite of 101 is -101
101 doubled is 202
one-half of 101 is 50.5
101 squared is 10201
the reciprocal of 101 is 0.009900990099009901
one-tenth of 101 is 10.1 and 10.1 squared is 102.00999999999999
101 minus the last digit of 101 is 100
the sum of 101 and 102 and 103 is 306

Enter an integer: -42
the opposite of -42 is 42
-42 doubled is -84
one-half of -42 is -21.0
-42 squared is 1764
the reciprocal of -42 is -0.023809523809523808
one-tenth of -42 is -4.2 and -4.2 squared is 17.64
-42 minus the last digit of -42 is -44
the sum of -42 and -41 and -40 is -123

Enter an integer: 3141592
the opposite of 3141592 is -3141592
3141592 doubled is 6283184
one-half of 3141592 is 1570796.0
3141592 squared is -234551744
the reciprocal of 3141592 is 3.183099524062959E-7
one-tenth of 3141592 is 314159.2 and 314159.2 squared is 9.869600294464001E10
3141592 minus the last digit of 3141592 is 3141590
the sum of 3141592 and 3141593 and 3141594 is 9424779
```