# Exercise I ```Exercise I
 Fill in the 10 blanks in the program below:
/*
The user enters three integers. The program prints the su
m, average, and product of these numbers.
*/
import _java.util.Scanner;
public class Numcomputation{
public static void main(String[] args)
{
int num1, num2, num3, sum, __product___________;
double __average_________;
System.out.println(&quot;Enter 3 integers: &quot;);
Scanner scanner = new Scanner( System.in );
System.out.print( &quot;The first integer: &quot; );
String input = scanner.nextLine();
num1 = Integer.parseInt( input );
System.out.print( &quot;The second integer: &quot; );
String input2 = scanner.nextLine();
num2 = Integer.parseInt( input 2);
System.out.print( &quot;The third integer: &quot; );
String input3 = scanner.nextLine();
num3 = Integer.parseInt( input 3);
__sum___________ = num1 + num2+ num3;
System.out.println(num1 +&quot;+&quot; + ___num2________ + &quot;+&quot; +num3
+ &quot;=&quot; +sum);
product = num1 * num2 * num3;
System.out.println(&quot;Product is &quot;+ __product___________ );
average = sum / 3.0;
System.out.println(&quot;Ave is &quot; + ___average__________ );
}
}
 Using Java, let socialSecurityNum be a variable of type int.
(a) Show how to declare this variable and initialize it to the value 123456789
using Java.
Int socialSecurityNum;
SocialSecurityNum =123456789;
Or 1 step:
Int socialSecurityNum=123456789;
(b) In general, can we store any 9-digit social security number using the data
type int? Explain.
Yes, the maximum value that int can hold is 2,147,483,647.
Int is 32 bits
(c) What is the output of the following two statements, if
socialSecurityNum stores the value 123456789? Explain how the Java
computes each expression.
System.out.println(socialSecurityNum / 10000);
12345
System.out.println(socialSecurityNum % 1000)); 789
 Predict the output that would be shown in the terminal window when the fol
lowing program fragments are executed:
Fragment
output
Error Message!
int myint = 3.23;
System.out.println(myint);
2
int calc = 15 % 7 * 2;
System.out.println(calc);
System.out.println(&quot;Hi &quot;);
System.out.println(&quot;WIT,\n COMP128n
is&quot;);
System.out.println(&quot;very fun! &quot;);
Hi
WIT,
COMP128n is
Very fun!
1.0
double result;
result = 7 / 4;
System.out.println(result);
3.0
double result;
result = 5 / 2 * 1.5;
System.out.println(result);
 Translate these mathematical expressions to Java expressions:
a)
http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html
In the Java docs, look for a list of methods in the method summary. Choose serveral
methods and write a brief description for each.
Example:
abs(double a):
Returns the absolute value of a double value.
b)
x=(5*Math.pow(x,3) –x + 7)/(2*Math.pow(x,2) );
x
5x3  x  7
2x2
x
 b  b 2  4ac
2a
c  sin x  cos x
5] Write a Java program, that reads in 3 double typed numbers a,b,c and prints the s
olution to the linear equation: ax+b=c . Name your program Question4.
 Write a program that converts a temperature from Fahrenheit to Celsius. Th
e user inputs a temperature in degrees Fahrenheit, and the program prints out
the temperature in degrees Celsius. Your code must follow the output in the sa
mple run below. Name your program Question5.
Recall that to convert from Fahrenheit to Celsius you use this formula:
/* sample run:
Enter the temperature in Fahrenheit: 80
That is 26.6667 degrees Celsius.
*/
```