Professional Documents
Culture Documents
Date:_________________
3. What is the purpose of the PSVM method header? Write the entire header.
4. Describe the life cycle of a program in Java, from what you write to the
execution by the computer.
Display:
6. Write a single statement to display your age.
Mixed Mode Arithmetic: Identify the value of x, assuming the statements are
executed in Java and are separate from each other.
8. int x = 6*2+(3-5);
12.int a = 6/4;
double x = 3*a;
9. int a = 4;
int b = 3 a;
int x = a*b;
13.int a = 5.3;
double x = a;
10.double a = 13.4;
int b = 2;
double x = 2*a/b;
14.int a = 76%14;
int b = 13 (12*a);
double x = b;
11.double a = 13.4;
int b = 2;
int x = 2*a/b;
15.int a = 5*(2.4/1.2);
16.double x = 6
22.
23.int x = (double)(3.8-4);
24.
25.double x = (int)(7.2/3.5);
26.
27.double x = (int)5.2*12 + 1;
28.
29.Program: Write a full program that satisfies the following specifications.
30.Declare two variables, one each for the length and width of a rectangular
field. Initialize each variable to an appropriate value. Identify, store, and
display the perimeter and area of the rectangular field.
31.
32.
33.
34.
35.
36.Declare and initialize a variable which stores the radius of a circle (initialize
the radius to a number of your choosing). If the circle is inscribed within a
square, find the area outside of the circle, but inside of the square (the
shaded region in the figure below). Store and display the calculated area. Use
3.14 or the statement Math.PI to represent pi.
37.