Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions

Question

What are the pros and cons of using credit? (p. 321)

Answered: 1 week ago