Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is output by the following program? Suppose the input is: 20 15 import java.util.*; public class Mystery { public static Scanner console = new

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(String[] args) {

int a, b;

double z;

char grade;

a = 25;

System.out.println("a = " + a);

System.out.print("Enter the first integer: ");

a = console.nextInt();

System.out.println();

System.out.print("Enter the second integer: ");

b = console.nextInt();

System.out.println();

System.out.println("The numbers you entered are " + a + " and " + b);

z = X + 2 * a - b;

System.out.println("z = " + z);

grade = 'A';

System.out.println("Your grade is " + grade);

a = 2 * NUM + (int) z;

System.out.println("The value of a = " + a);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

9. Explain the relationship between identity and communication.

Answered: 1 week ago

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago