CS140-01, Questions of Quiz March 6, 2018, Quiz Find out and correct the ten (10
ID: 3724649 • Letter: C
Question
CS140-01, Questions of Quiz March 6, 2018, Quiz Find out and correct the ten (10) emors in the following Java peogms samed in the file simplieExample-java 1simpleExample java 4 import java.util.Scanner 6 public class SimpleExample private static void main (Stringll args) int num1 - 0; num2 int product, sum; Scanner input Scanner( Systemin ); 10 12 13 14 15 16 17 18 19 20 System.out,print( "Please enter an integer:") num! = input.nextInt0; System.out print Please enter the 2nd integer.) num2- input.nextLine num1 + num2 sum; product= num1 * num2; 21 System.out.print(-The sum of these two numbers is %dna", sum ); System-outprinti( "The product of these two numbers is %dna", product ); 23 24 25Explanation / Answer
package chegg1;
import java.util.Scanner;
public class SimpleExample{
public static void main(String[] args) {
// corrected code you have to declare num2
int num1=0,num2;
int product,sum;
Scanner input= new Scanner(System.in);
System.out.println("Please enter the Interger");
num1= input.nextInt();
System.out.println("Please enter 2nd Interger");
// corrected line (for integer use nextInt() for string use nextLine()
num2=input.nextInt();
// corrected line
sum=num1+num2;
product= num1*num2;
// corrected line
System.out.println("Sum of the two number is "+sum);
// corrected line
System.out.println("The product of the two number is "+product);
}
}