subject

Copy the following code into a new Java file in Eclipse.

import java. util. Scanner;

public class EclipseVsZyBooks {

public static void main(String[] args) {

System. out. println("Enter an integer: ");

int a = readInt();

System. out. println("Enter a second integer: ");

int b = readInt();

if(a == b)

System. out. println(a + " equals " + b);

else if (a < b)

System. out. println(a + " is less than " + b);

else

System. out. println(a + " is more than " + b);

}

public static int readInt() {

Scanner sc = new Scanner(System. in);

return sc. nextInt();

}

}

(2) Run the code in Eclipse.

(3) Try running the code in 1.14 zyBooks built-in programming window, using the same input that you did in (2). You can use this environment to test your code before submitting it to zyBooks.

(4) Try submitting the code. You should see that the 3 tests produce the same error you saw in (3).

(5) The code should run fine in (2), but give you errors in (3) and (4). Refactor the code so that it works in zyBooks just as it does in Eclipse.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:20
Your program will make use of long long int variables for all calculations. note: the use of long long int requires that you have c++11 support. you should have this automatically if you are using a newer version of visual studio. the support is there for gcc as well, but you may need the -std=c++11 or -std=c++0x compiler flag. you first need to read in the total number of seconds. there is no prompt for the read (that is, you just do the cin without using a cout to display a prompt). this is going to seem a little strange when you are running your program in your ide
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 21:30
Write an algorithm to check if a number is even or odd and show with flow chart step by step
Answers: 2
You know the right answer?
Copy the following code into a new Java file in Eclipse.

import java. util. Scanner;
Questions
question
Mathematics, 19.05.2021 14:30
question
History, 19.05.2021 14:40
question
Mathematics, 19.05.2021 14:40
question
Mathematics, 19.05.2021 14:40
Questions on the website: 13722367