Example Code Ch 02-2
import java.util.Scanner;
public class Questions33_34
{
public static void main(String[] args)
{
int x, y, z;
double average;
Scanner scan = new Scanner(System.in) ;
System.out.println("Enter an integer value") ;
x = scan.nextInt() ;
System.out.println("Enter another integer value") ;
y = scan.nextInt() ;
System.out.println("Enter a third integer value") ;
z = scan.nextInt() ;
average = (x + y + z) / 3;
System.out.println("The result of my calculation
is " + average) ;
}
}
-Refer to Example Code Ch 02-2. This code computes
A) The correct average of x, y, and z as a double
B) The correct average of x, y, and z as an int
C) The average of x, y, and z as a double but the result may not be accurate
D) The sum of x, y, and z as an int
E) The remainder of the sum of x, y, and z divided by 3
Correct Answer:
Verified
Q51: How do the statements "import java.util.*;" and
Q52: Java is a strongly typed language. What
Q53: Since you cannot take the square root
Q54: Given x is a double and has
Q55: Write the paint method for an applet
Q57: An employer has decided to award a
Q58: Provide an example of how you might
Q59: What will be the value of z
Q60: In order to create a constant, which
Q61: Write a program that will input some
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents