Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you help me create this in java? Design and implement a Java program that wi

ID: 3646807 • Letter: C

Question

Can you help me create this in java?

Design and implement a Java program that will gather floating point numbers and determine the sum and

average of the data entered.

Declare all necessary identifiers.

Inside a while loop:


Accept decimal numbers using a Dialog Input box.

Sum the decimal numbers as they are entered.

When the sum of the entered decimal numbers is above a total of 100 for the first time:

Display a message with a Message Dialog informing the user that the total number is over 100.

In addition to the warning also display in the Message Dialog the actual total sum at that point.

Do not show this message again for any additional entries above 100.

Keep a counter for the number of times a new decimal number is entered.

Have a prompt asking the user when to end entering decimal numbers.

Use a sentinel to end the loop in combination with a prompt.

After the loop, call a calculation method that will return the average from the sum and counter. [An example of the construction of a method with its

Explanation / Answer

import javax.swing.JOptionPane; public class Yournameproject2revised { public static void main(String[] args) { double sum = 0; double average = 0; double NUMBER_OF_ATTEMPTS = 5; //Keep reading data until the user enters No double option = JOptionPane.YES_OPTION; while (option == JOptionPane.YES_OPTION) { //Read the next data String dataString = JOptionPane.showInputDialog ("Enter a double value: "); double data = Double.parseDouble(dataString); sum += data;//calculating the sum of the numbers entered if (sum > 100) //If sum is greater than 100 than the warning message appears below JOptionPane.showMessageDialog(null, "Warning...values have exceeded a sum of 100"); option = JOptionPane.showConfirmDialog(null, "Continue?"); average = sum / NUMBER_OF_ATTEMPTS; } JOptionPane.showMessageDialog(null, "The sum is" + " " + sum + " " + "and the average is" + " " + average); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote