8:03 PM Personal Hotspot: 1 Connection a kennesaw.view.usg.edu l Verizon LTE CSE
ID: 3744974 • Letter: 8
Question
8:03 PM Personal Hotspot: 1 Connection a kennesaw.view.usg.edu l Verizon LTE CSE 1321L: Programming and Problem Solving Lab Lab 3 Type Systems and Expressions Exercise #1: Design and implement a program (name it SumValue) that reads three integers (say X, Y, and Z) and prints out their values on separate lines with proper labels, followed by their average with proper label. Comment your code properly. Format the outputs following the sample runs below Y-2 Average3.0 Z10 Average8.333333333333334 x=7 = -5 Average-0.3333333333333333Explanation / Answer
import java.util.Scanner; public class SumValue { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); int z = in.nextInt(); System.out.println("X = " + x); System.out.println("Y = " + y); System.out.println("Z = " + z); System.out.println("Average = " + ((x+y+z)/3.0)); } }