|(CALCULATE AVERAGE OF 3 NUMBERS) You will be given three integer variables, number1, number2 and number3, which will be

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

|(CALCULATE AVERAGE OF 3 NUMBERS) You will be given three integer variables, number1, number2 and number3, which will be

Post by answerhappygod »

Calculate Average Of 3 Numbers You Will Be Given Three Integer Variables Number1 Number2 And Number3 Which Will Be 1
Calculate Average Of 3 Numbers You Will Be Given Three Integer Variables Number1 Number2 And Number3 Which Will Be 1 (250.06 KiB) Viewed 36 times
JAVA
|(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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply