JAVA_Chapter_3_Programming_Assignments

JAVA_Chapter_3_Programming_Assignments - JAVA Chapter 3...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Data Types REVIEW PROBLEMS: 1. Write the following mathematical expressions in Java: a. s = s 0 + v 0 t + ½ gt 2 b. c = √(a 2 + b 2 – 2abcos y) 2. Write the following Java expressions in mathematical notation: a. volume = Math.PI * r * r * h; b. dm = m * ( (Math.sqrt(1 + v / c ) / Math.sqrt(1 – v / c )) – 1); 3. Explain the difference between 2, 2.0, ‘2’, “2”, and “2.0”. 4. Explain what each of the following two program segments computes: a. x = 2; y = x + x; b. s = “2”; t = s + s; 5. How do you get the first character of a string? The last character? How do you remove the first character? The last character? 6. What is a final variable? Can you define a final variable without supplying its value? 7. What are the values of the following expressions? Assume that for each line… double x = 2.5; double y = -1.5 int m = 18; int n = 4; String s = “Hello”; String t = “World”; a. x + n * y – (x + n) * y b. m / n + m % n c. 5 * x – n / 5
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/28/2010 for the course COMP COMP taught by Professor Huye during the Spring '10 term at Eastern Oregon.

Page1 / 2

JAVA_Chapter_3_Programming_Assignments - JAVA Chapter 3...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online