Question
I got 0 as the result of trying to find the area of the circle and radius of the circle import java.util.Scanner; public class J1_10_22
I got 0 as the result of trying to find the area of the circle and radius of the circle
import java.util.Scanner; public class J1_10_22 { public static void main(String[] args) { Scanner input = new Scanner(System.in); double areaOfCircle = 0; double radius = 0; /*creating the class*/ FindingTheCircle Circle = new FindingTheCircle(); /*calling the methods*/ Circle.inputForCircle(); Circle.calculateTheCircle(); Circle.outputForCircle(); } } class FindingTheCircle { private double areaOfCircle; private double radius; double cm; public void inputForCircle () { { Scanner input = new Scanner (System.in); System.out.println("Finding the cm of the circle: "); double cm = input.nextDouble(); } } public void calculateTheCircle() { areaOfCircle = 3.14 * (cm * cm); System.out.println(areaOfCircle); radius = 3.14 * cm; System.out.println(radius); } public void outputForCircle() { System.out.println("The area of the circle is: " + areaOfCircle); System.out.println("The radius of the circle is: " + radius); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started