Java TOPIC 07 – ARITHMETIC
EXPRESSIONS LESSON WORK QUESTION
1 What value will the variable t get? You must test each one in a Java
program to make sure! Because you
cannot have the same variable twice inside the same program, you can rename
the variable so that you can test all four in one program. Careful, some of these results are surprising at
first! a) int t = 1 + 6 * 5; b) int t = 12 + 60 / (2 * 3); c) int t = 3 + (int)(2.0/3.0); d) int t = 100 % 3; e) double
t = 8; f) double
t = 7.0 + (int)4.1 + 2.2; g) double
t = 5/2; Save
your work inside the file Question1.java
in the topic07 folder. QUESTION 2 Write
a program called RectangleArea that will implement
the following pseudo-code:
Save
your work inside the RectangleArea.java
file in the topic07 folder. QUESTION 3 Write
a program called YearlySalary that will implement
the following pseudo-code:
Save
your work in a file called YearlySalary.java
inside the topic07 folder. |
|