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

Java Assignment First, launch NetBeans and close any previous projects that may

ID: 3875515 • Letter: J

Question

Java
Assignment


First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).


Then, create a new Java application called "AverageCalculator" (without the quotation marks) that prompts the user with three separate prompts for three numbers (use double values for these), computes the average of those three doubles (use a double for the average), and then prints out explanatory text, the three numbers, and their average, printed with 2 decimal places. (See Horstmann, Section 2.3.2, pp. 50-52 for some ideas.)


For example, if the user gives your program the numbers 30, 100, and 21, your output should look very much like the following: The average of the numbers 30.00, 100.00, and 21.00 is 50.33.

thank you


Explanation / Answer

import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
float x=30;
float y=100;
float z=21;
  float average=(x+y+z)/3;

System.out.print("the average of");

System.out.println(String.format("%.2f", x) +","+ String.format("%.2f", y) +","+String.format("%.2f", z)+"="+String.format("%.2f", 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