|(CALCULATE AVERAGE OF 3 NUMBERS) You will be given three integer variables, number1, number2 and number3, which will be
Posted: Fri May 20, 2022 11:26 am
|(CALCULATE AVERAGE OF 3 NUMBERS) You will be given three integer variables, number1, number2 and number3, which will be initialized for you. Your job is to calculate the average of these numbers and store it in a variable named averageValue. Output has been taken care of for you! It is rounded to 2 decimal places.
SAMPLE INPUT/OUTPUT: Input Output 2 Average number = 3.00 AWN 3 4 22 Average number = 33.00 22 55 6 9 Average number = 9.33 7
1 Exit Full Screen POD.java + New 6 * @version 1.0 7 * @since 2020-05-01 8 */ 9 10- import java.util.Scanner; 11 12- public class POD { 13 public static void main(String[] args) { 14 15 //Create a Scanner object to read input from the keyboard 16 Scanner in = new Scanner(System.in); 17 18 //Declare three double variables and initialize (based on input) 19 int number1 in.nextInt(); 20 int number2 in.nextInt(); 21 int number3 in nextInt(); 22 23 24 || Start your work here || 25 26 27 //HINT 1: Remember BEDMAS 28 //HINT 2: You will need to declare a double variable 29 //HINT 3: Remember that int/int -> int, but int/double -> double 30 31 32 33 34 || End your work here IT 35 36 37 //Output 38 System.out.printf("Average number = %.2f", averageValue); 39 } 40 } 41