Write the value of the expression after each of the following statements is exec
ID: 3759609 • Letter: W
Question
Write the value of the expression after each of the following statements is executed. Make sure you clearly specify the type of the value for each expression. (That is, if the answer is a double 5, write 5.0 instead of 5).
double x = 2.5, y = -1.5;
int m = 21, n = 5;
String s = "Computer";
String t = "ASU";
System.out.println(s+t); _______________
System.out.println(s.substring(1, 3)); _______________
System.out.println(s.length() + t.length()); ______________
System.out.println((int)(10.0/4.0) * 6 - 1 / 2 * 3); _____________
System.out.println(8 % 3 + (double)(15 / 7) / 2); _____________
System.out.println(x + n * y - (x + n) * y); ______________
System.out.println(5 * x - n / 5); ______________
System.out.println(m / n + m % n); _____________
Explanation / Answer
double x = 2.5, y = -1.5;
int m = 21, n = 5;
String s = "Computer";
String t = "ASU";
System.out.println(s+t); ___________ComputerASU(String)____
System.out.println(s.substring(1, 3)); ___OM(String)____________
System.out.println(s.length() + t.length()); __11 __(int)__________
System.out.println((int)(10.0/4.0) * 6 - 1 / 2 * 3); _______12(int)______
System.out.println(8 % 3 + (double)(15 / 7) / 2); _______3.0______
System.out.println(x + n * y - (x + n) * y); ____6.25__________
System.out.println(5 * x - n / 5); ______11.5________
System.out.println(m / n + m % n); __ 5___________
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.