Could someone please answer this Eclipse ThreeNumbers questi

Could someone please answer this Eclipse ThreeNumbers question for me? I am having trouble with it, thanks!

Write a program that reads in three integers and prints out their sum and product and average

Input The input will be one or more lines of numbers that have been typed in by the user. Each line is to have exactly three real numbers.

Output The output will have for each line, the numbers that had been read in separated by a single space followed by their sum, product, and average separated by a space. Each number is to be printed using \"%.2e\" format (see hint below).

Sample Input 1 2 3 1.1 2.2 3.3

Sample Output 1.00e+00 2.00e+00 3.00e+00 6.00e+00 6.00e+00 2.00e+00 1.10e+00 2.20e+00 3.30e+00 6.60e+00 7.99e+00 2.20e+00

HINT Here use in.nextDouble() to read a number. After reading three doubles, use in.nextLine() – so that you discard the rest of the \"white spaces\". To print two numbers num1 and num2 using %.2e format, I would use System.out.printf(\"%.2e %.2e\ \", num1, num2); The \ is used to make sure it prints a newline character.

Solution

Output:

1 2 3

1.00e+00 2.00e+00 3.00e+00 6.00e+00 6.00e+00 2.00e+

Could someone please answer this Eclipse ThreeNumbers question for me? I am having trouble with it, thanks! Write a program that reads in three integers and pri

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site