This paper contains bidirectional Unicode message that might be interpreted or compiled in different ways than what appears below. To review, open the file in an editor that reveals surprise Unicode characters. Learn much more about bidirectional Unicode characters
The adhering to program consists of 9 errors. Correct the errors and also submit a working version of the program. The corrected variation of the regime should develop the adhering to output:
x is 0
x is currently 15
x and y space 15 and 16
// find ERRORS
public class Oops2 
public static void main(String<> args) 
int x;
System.out.println("x is " x);
int x = 15.2; // set x to 15.2
System.out.println("x is now + x");
int y; // set y to 1 more than x
y = int x + 1;
System.out.println("x and y are " + x + and + y);
// Solution
public class Oops2 
public static void main(String<> args) 
int x = 0;
System.out.println("x is " + x);
x = 15; // set x to 15
System.out.println("x is now " + x);
int y = 0; // set y to 1 more than x
y = x + 1;
System.out.println("x and y are " + x + " and " + y);

This paper contains bidirectional Unicode message that might be construed or compiled differently than what appears below. To review, open up the paper in one editor the reveals covert Unicode characters. Learn more about bidirectional Unicode characters
Suppose you have an int variable referred to as number. What Java expression produces the second-to-last digit of the number (the 10s place)?
What expression to produce the third-to-last digit of the number (the 100s place)?
number / 10 % 10
number / 100 % 10

This paper contains bidirectional Unicode text that may be understood or compiled in different way than what shows up below. To review, open up the file in an editor the reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
What is the worth of change x ~ the adhering to code executes?
int x = 3;
x = x + 2;
x = x + x;
A:
10

This record contains bidirectional Unicode text that may be construed or compiled in different way than what appears below. To review, open the file in one editor the reveals covert Unicode characters. Learn much more about bidirectional Unicode personalities
What space the worths of a, b, and c after the following code statements?
int a = 5;
int b = 10;
int c = b;
a = a + 1;
b = b - 1;
c = c + a;
A;
a = 6
b = 9
c = 16

This paper contains bidirectional Unicode text that might be interpreted or compiled differently than what shows up below. Come review, open the record in an editor that reveals surprise Unicode characters. Learn more about bidirectional Unicode personalities
What room the worths of very first and 2nd at the end of the complying with code?
int an initial = 8;
int 2nd = 19;
first = first + second;
second = an initial - second;
first = first - second;
A:
first = 19
second = 8

This paper contains bidirectional Unicode message that may be taken or compiled in different ways than what appears below. Come review, open the record in an editor that reveals covert Unicode characters. Learn much more about bidirectional Unicode personalities
Rewrite the adhering to code indigenous the previous exercise to it is in shorter, by proclaiming the variables together on the exact same line,
and by utilizing the distinct assignment operators (e.g., +=, -=, *=, and also /=) together appropriate.

You are watching: 2.5 * 2 + 8 / 5.0 + 10 / 3

int an initial = 8;
int 2nd = 19;
first = first + second;
second = an initial - second;
first = first - second;
A:
int an initial = 8, 2nd = 19;
first += second;
second = very first - second;
first -= second;

This file contains bidirectional Unicode text that might be interpreted or compiled in different ways than what shows up below. To review, open up the document in one editor the reveals surprise Unicode characters. Learn much more about bidirectional Unicode personalities
What room the values of i, j, and k after ~ the following code statements?
int i = 2;
int j = 3;
int k = 4;
int x = i + j + k;
i = x - i - j;
j = x - j - k;
k = x - i - k;
A:
i = 4
j = 2
k = 1

This paper contains bidirectional Unicode text that might be interpreted or compiled in different way than what appears below. Come review, open up the document in one editor the reveals concealed Unicode characters. Learn more about bidirectional Unicode personalities
int max;
int min = 10;
max = 17 - 4 / 10;
max = max + 6;
min = max - min;
System.out.println(max * 2);
System.out.println(max + min);
System.out.println(max);
System.out.println(min);
A:
46
36
23
13

This record contains bidirectional Unicode message that might be interpreted or compiled in different way than what appears below. To review, open the paper in one editor that reveals concealed Unicode characters. Learn more about bidirectional Unicode personalities
The following program redundantly repeats the same expressions many times.
Modify the regimen to remove all redundancy expressions using variables of appropriate types.
public class ComputePay
public static void main(String<> args)
// calculate pay at work based on hours worked each day
System.out.println("My total hours worked:");
System.out.println(4 + 5 + 8 + 4);
System.out.println("My hourly salary:");
System.out.println("$8.75");
System.out.println("My full pay:");
System.out.println((4 + 5 + 8 + 4) * 8.75);
System.out.println("My counting owed:"); // 20% tax
System.out.println((4 + 5 + 8 + 4) * 8.75 * 0.20);
public class ComputePay 
public static void main(String<> args) 
// Calculate pay at work based on hours worked each day
int totalHours = 4 + 5 + 8 + 4;
twin hourlyPay = 8.75;
dual totalPay = (totalHours) * hourlyPay;
dual taxesOwed = (totalHours) * hourlyPay * 0.20;
System.out.println("My total hours worked:");
System.out.println(totalHours);
System.out.println("My hourly salary:");
System.out.println("$" + hourlyPay);
System.out.println("My total pay:");
System.out.println(totalPay);
System.out.println("My taxes owed:"); // 20% tax
System.out.println(taxesOwed);

This document contains bidirectional Unicode text that may be construed or compiled in different way than what shows up below. Come review, open the file in one editor the reveals surprise Unicode characters. Learn much more about bidirectional Unicode personalities
Which that the complying with are legal int literals?
22
5.
2.3
10.0
1.5
'7'
-6875309
-1
A:
22
-6875309
-1

This document contains bidirectional Unicode text that might be interpreted or compiled in different way than what shows up below. To review, open the paper in an editor the reveals hidden Unicode characters. Learn an ext about bidirectional Unicode personalities
The complying with program redundantly repeats the very same expressions plenty of times.
Modify the routine to eliminate all redundancy expressions utilizing variables of appropriate types.
// This program computes the total amount owed for a meal,
// assuming 8% tax and a 15% tip.

See more: Which Of The Following Animals Displays Radial Symmetry In Organismal Biology

public class Receipt 
public static void main(String<> args) 
System.out.println("Subtotal:");
System.out.println(38 + 40 + 30);
System.out.println("Tax:");
System.out.println((38 + 40 + 30) * .08);
System.out.println("Tip:");
System.out.println((38 + 40 + 30) * .15);
System.out.println("Total:");
System.out.println(38 + 40 + 30 +
(38 + 40 + 30) * .08 +
(38 + 40 + 30) * .15);
public class Receipt 
public static void main(String<> args) 
int subTotal = 38 + 40 + 30;
double taxOnTotal = subTotal * 0.08;
twin totalWTip = subTotal * 0.15;
dual total = subTotal + taxOnTotal + totalWTip;
System.out.println("Subtotal:");
System.out.println(subTotal);
System.out.println("Tax:");
System.out.println(taxOnTotal);
System.out.println("Tip:");
System.out.println(totalWTip);
System.out.println("Total:");
System.out.println(total);

This paper contains bidirectional Unicode text that might be taken or compiled differently than what shows up below. Come review, open the file in an editor that reveals concealed Unicode characters. Learn much more about bidirectional Unicode personalities
Complete the complying with code, replacing the "FINISH ME" parts with your own code, to produce the adhering to output:
2 time 1 = 2
2 time 2 = 4
2 times 3 = 6
2 times 4 = 8
public course Count2 {
public static void main(String<> args) {
because that (int i = 1; ns raw
This record contains bidirectional Unicode message that may be understood or compiled differently than what shows up below. To review, open up the paper in an editor that reveals covert Unicode characters. Learn more about bidirectional Unicode characters
What is the output of the following oddStuff method?
public revolution void oddStuff() {
int number = 4;
for (int count = 1; counting life
This paper contains bidirectional Unicode text that might be construed or compiled in different way than what appears below. Come review, open up the file in one editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode personalities
What is the calculation of the complying with loop?
System.out.println("+----+");
for (int i = 1; ns life

life

life

raw
Trace the review of the following expressions, and give their resulting values.
Make certain to provide a value of the appropriate type (such as consisting of a .0 in ~ the finish of a double or quotes approximately a String).
2 + 2 + 3 + 4= 11
"2 + 2 " + 3 + 4= "2 + 2 34"
2 + " 2 + 3 " + 4= "2 2 + 3 4"
3 + 4 + " 2 + 2"= "7 2 + 2"
"2 + 2 " + (3 + 4)= "2 + 2 7"
"(2 + 2) " + (3 + 4)= "(2 + 2) 7"
"hello 34 " + 2 * 4= "hello 34 8"
2 + "(int) 2.0" + 2 * 2 + 2= "2(int) 2.042"
4 + 1 + 9 + "." + (-3 + 10) + 11 / 3= "14.73"
8 + 6 * -2 + 4 + "0" + (2 + 5)= "007"
1 + 1 + "8 - 2" + (8 - 2) + 1 + 1= "28 - 2611"
5 + 2 + "(1 + 1)" + 4 + 2 * 3= "7(1 + 1)46"
"1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9)= "123430717"



raw

raw

life

life

life
<br> <br> <br> <h3> <img class=2.5 * 2 + 8 / 5.0 + 10 / 3 -->