# Java expressions in mathematical notation

• Write the following Java expressions in mathematical notation.
a. dm = m * (Math.sqrt(1 + v / c) / Math.sqrt(1 – v / c) – 1);b. volume = Math.PI * r * r * h;

c. volume = 4 * Math.PI * Math.pow(r, 3) / 3;

Don't use plagiarized sources. Get Your Custom Essay on
Java expressions in mathematical notation
Just from \$13/Page

d. z = Math.sqrt(x * x + y * y);

• R2.6 What are the values of the following expressions? In each line, assume that
double x = 2.5;
double y = -1.5;
int m = 18;
int n = 4;a. x + n * y – (x + n) * y

b. m / n + m % n

c. 5 * x – n / 5

d. 1 – (1 – (1 – (1 – (1 – n))))

e. Math.sqrt(Math.sqrt(n))

• R2.7 What are the values of the following expressions, assuming that n and m have type int, n is 17, and m is 18?
a. n / 10 + n % 10b. n % 2 + m % 2

c. (m + n) / 2

d. (m + n) / 2.0

e. (int) (0.5 * (m + n))

f. (int) Math.round(0.5 * (m + n))

• R2.8 What are the values of the following expressions? In each line, assume that
String s = “Hello”;
String t = “World”;a. s.length() + t.length()

b. s.substring(1, 2)

c. s.substring(s.length() / 2, s.length())

d. s + t

e. t + s Grab A 14% Discount on This Paper
Pages (550 words)
Approximate price: -
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Try it now!

## Grab A 14% Discount on This Paper

Total price:
\$0.00

How it works? Fill in the order form and provide all details of your assignment. Proceed with the payment

Choose the payment system that suits you most. 