What is output by the following program? Suppose the input is: 20 15 import java
ID: 3734014 • Letter: W
Question
What is output by the following program? Suppose the input is: 20 15 import java.util.. public class Mystery public static Scanner console new Scanner(System.in) public static final int NUM 10; public static final double X 20.5; public static void main(StringlI args) { int a, b double z; char grade a 25 System.out.println("a"a); System.out.print("Enter the first integer: ) a console.nextlnt() System.out,printin0) System.out.print("Enter the second integer "); bconsole.nextlnt() System.out.println() System.out println("The numbers you entered are" + a"and" +b) System.out. printin("Z") grade 'A System.out.println( Your grade is" + grade) a-2" NUM + (int) z; System.out.println("The value of aa) For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac)Explanation / Answer
Acoording to problem output will be
your code with my comment
import java.util.*;
public class Mystery
{
public static Scanner console=new Scanner(System.in);
public static final int NUM=10;
public static final double X=20.5;
public static void main(String[] args)
{
int a,b;
double z;
char grade;
a=25;
System.out.println("a="+a);//print value of a
System.out.print("enter the first intiger");
a=console.nextInt();//take first intiger
System.out.println();
System.out.print("enter the second intiger");
b=console.nextInt();//take second intiger
System.out.println();
System.out.println("the numbers are entered "+ a + " and " + b);
z=X+2*a-b;// value of Z
System.out.println("z=" + z);
grade='A';
System.out.println("grade=" + grade);
a=2*NUM+(int)z;// modify value of a
System.out.println("the value of a =" + a);
}
}
if you got my point then please like
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.