Question: Update Problems 1 to use System.out.printf ( ) to format the output so that all relevant information is displayed to the user. Copy Problem 1

Update Problems 1 to use System.out.printf() to format the
output so that all relevant information is displayed to the user. Copy Problem 1 into a new file named Lab05Prob04.java and modify it so that all values displayed have exactly two decimal points. This updated program from Problem 1 is the only one that will be
submitted to Gradescope for this problem and should be used as a model to complete the printf() conversion for the other problems import java.util.Scanner;
public class Lab05Prob01{
public static void main (String[] args){
// Initializing the scanner at the start of the project
Scanner input = new Scanner(
System.in);
// Prompting user input
System.out.print("Please enter your side values.");
System.out.println("Side one =");
double s1= input.nextDouble();
System.out.println("Side two =");
double s2= input.nextDouble();
System.out.println("Side three =");
double s3= input.nextDouble();
// Calculating and printing the area of the triangle
double area =(s1+ s2+ s3)/2.\thetad;
double heronsF = Math.sqrt(area *(area-s1)*(area-s2)*(area-s3));
System.out.println("For side lengths of "+(s1)+","+(s2)+","+(s3)+", the area is "+(heronsF)+".");
}
Problem 1 is provided in text
Update Problems 1 to use System.out.printf ( ) to

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 Programming Questions!