Question

V Evaluate each of the following according to the JAVA precedence rules. In each case, show...

V Evaluate each of the following according to the JAVA precedence rules.

In each case, show what value is stored in the variable on the left-hand side.

SHOW YOUR WORK SO IT IS CLEAR WHICH OPERATION IS DONE FIRST, THEN SECOND, ETC., UNTIL THE FINAL ANSWER.

DON’T SKIP STEPS. Start from these initial values each time.

   int b = 4, p = 7, r = 2, v = 8;

   double x;

  

(i) x = (double) p / r + 3 * b - 5; x =

(ii) x = v % b + 10 - p / r * r; x =

(iii) Write the JAVA statement to perform the following:

Assign x the value of p multiplied by r+6, all divided by the square root of the sum of b and p

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

Given data:

i)

int b = 4, p = 7, r = 2, v = 8;

x = 7 / 2 + 3 * 4 - 5

x = 7 / 2 + 12 - 5

x = 3.5 + 12 - 5

x = 15.5 - 5

x = 10.5

ii)

x = v % b + 10 - p / r * r;

x = 8 % 4 + 10 - 7 / 2 * 2;

x = 0 + 10 - 7 / 2 * 2;

x = 10 - 3 * 2;

x = 10 - 6;

x = 4

iii)

x = (p * (r+6)) / Math.sqrt(b+p);

Add a comment
Know the answer?
Add Answer to:
V Evaluate each of the following according to the JAVA precedence rules. In each case, show...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT