38.9k views
0 votes
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;

String s = "Storm";

String t = "Watch";

x + n*y - (x+n)*y ______________

m/n + m%n ______________

User Tpie
by
5.5k points

1 Answer

2 votes

Final answer:

The values of the expressions are -12.5 and 6.5.

Step-by-step explanation:

To find the values of the expressions, we need to substitute the given values for the variables. Let's evaluate each expression step by step:

  1. Expression 1: x + n*y - (x+n)*y
  2. Substituting the given values, we have:
  3. 2.5 + 4*(-1.5) - (2.5+4)*(-1.5)
  4. Simplifying the expression:
  5. 2.5 - 6 + 6*(-1.5)
  6. 2.5 - 6 - 9
  7. = -12.5
  8. Expression 2: m/n + m%n
  9. Substituting the given values, we have:
  10. 18/4 + 18%4
  11. Simplifying the expression:
  12. 4.5 + 2
  13. = 6.5

User Jackslash
by
5.3k points