Convert the following statements to equivalent statements that use the assignment operator shortcut. 

(3 points)

 

a)   X = X * 2;

 

b)   Y = Y % 2;

 

c)   Z = Z / 5;

 

Convert the following statements to equivalent statements that do NOT  use the assignment operator shortcut.  (3 points)

 

a)   X += 5;

 

b)   Y *= Y;

 

c)  Z -= 15;

 

Assume that X has the value 3.6 and Y  has the value 4.  State the value of the variable Z after the following statements.  (3 points)

 

a)  Z = Math.round(X);

 

b) Z = Math.pow(Y, 3);

 

c)  Z = Math.round(Math.sqrt(X));

 

Assume that X is 5 and Y is 10.  Write the values of the following expressions:  (3 points)

 

a)  X <= 10

 

b) X – 2 != 0

 

C) X > Y

 

Write the following expressions in Java Script (3 points)

                               

a)  B2 – 4AC

 

b)   D – B     

         2A

 

c)  (A2 + B2)

            2

 

For each of the following items, write a valid Java Script statement.  (5 points)

 

a)       Display “greater” if the value of variable X is greater than the value of variable Y.  Otherwise, display “less”.

b)       Add 10 to the value of X and display this value if the variable Y is negative.

c)       Display the letter A if X is greater than 90, letter B if X is greater than 80 and less than or equal to 90, or the letter C otherwise.

d)       Add 1 to the value of X .

e)       Subtract 1 from the value of Y.