Question: where would I place these numbers in the code to get this output //author: Jazmine Tap1ia //date: 7 January 2022 //file: CircleArea.java l Lab2 Part


where would I place these numbers in the code to get this output
//author: Jazmine Tap1ia //date: 7 January 2022 //file: CircleArea.java l Lab2 Part 2: Calculate the area of the circle collect user input with scanner object and also with joptionPane input dialog Perform the area calculation twice, since user input is collected two ways */ //import statements for Scanner and joptionPane import java.util.Scanner; import javax. swing. JoptionPane; public class circleArea \{ public static void main(String[] args) \{ //declare double variables for radius and area double radius, area; //declare String variable for use input dialog String inputString; //create Scanner object to read keyboard input Scanner keyboard = new Scanner(System.in); //get user input for the radius with the Scanner object System.out.println("Use Scanner object to collect user input for radius:"); System.out.print("Enter the radius: 2 "); radius = keyboard. nextDouble (); //calculate the area using Math library for the value of PI //use Math. pow to square the radius value area = Math.PI * (Math. pow ( radius, 2)); //display the result to the user System.out. println("The area of a circle with radius " + radius + " is " + area); //get user input with joptionPane input dialog System.out.println("Use JoptionPane input dialog to collect user input for the radius:"); //get user input for radius: inputString = JoptionPane.showInputDialog("Enter the radius: 2 "); //convert the string to a double and assign to radius radius = Double.parsedouble(inputString); //calculate the area using Math library for the value of PI //use Math. pow to square the radius value area = Math.PI * ( Math. pow ( radius, 2)); //display the result to the user System.out.println("The area of a circle with radius " + radius + " is " + area); \} Use Scanner object to collect user input for radius: Enter the radius: 2 The area of a circle with radius 2.0 is 12.566370614359172 Use JoptionPane input dialog to collect user input for the radius: The area of a circle with radius 3.0 is 28.274333882308138
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
