{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

JAVA_Chapter_3_Programming_Assignments

# JAVA_Chapter_3_Programming_Assignments - JAVA Chapter 3...

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

JAVA Chapter 3 Programming Assignments 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 d. Math.sqrt(Math.sqrt(n)) e. S + t f. S + n g.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.
• Spring '10
• huye
• Quadratic equation, English-language films, following mathematical expressions, driver program, Nancy Johnson

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online