Question: Write a java program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, convert the sum

Write a java program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, convert the sum to the nearest integer, and print the result.

Please either write a new one or fix my attempt. Thanks

Write a java program that prompts the user to input five decimal

* import java.util.*; public class Sum { static Scanner console = new Scanner(System.in); Run Debug public static void main(String[] args) { double a1, a2, a3, a4, a5; System.out.print("Enter 5 numbers in decimal form: "); a1 = a2 a4 = a5 console.nextDouble(); console.nextDouble(); console.nextDouble(); console.nextDouble(); console.nextDouble(); System.out.println("The sum is " + (a1+a2+a3+04+a5)); System.out.println("The INT sum is " + Math.round(a1+a2+a3+a4+a5)); + }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!