Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please help with computer science question 8. (4 points) Given variable Styles t

ID: 3848947 • Letter: P

Question

please help with computer science question


8. (4 points) Given variable Styles the definitions below, solve each mathematical statement as Java would. Watch for integer math, precedence and promotion. Also, be sure to use "0" to indicate doubles which happen to be (Note: Each calculation whole numbers like "1.0" should be done independently one statement should not affect the value of the variables for the follow statements. In other words, count and weight begin at the same value for each question below.) int count 53 double weight 26.5 a. Count 6 b Count count d. count weight e. count 2 weight count 1 o

Explanation / Answer

SOLUTION:-

A) count % 6 = 5    // Modulo is the remainder that we get after dividing the number

B) count++ = 54    // The ++ operator increments the value by adding 1 to the value

C) count += 2 ===> 55 // This is a shorthand equivalent to   count = count + 2

D) count/weight = 2.0 // Because division of int and double result in double

E) count + 2 * weight = 106.0   // Firstly weight will get multiply to 2 because * has higher precedence than + operator . Therefore result will be ( ( weight * 2) + count ) and operation between int and double result in double

F) count / 1.0 = 53.0 // Same reason operation between int and double (or float ) result in float

PLEASE RATE THE ANSWER !!!!

THANKS