Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java console application that prompts the user to enter the radius of a circle, then prints its radius, diameter, circumference, and area. Write

Write a Java console application that prompts the user to enter the radius of a circle, then prints its radius, diameter, circumference, and area. Write a JavaFX GUI application to do the same calculation, and draw the circle.

The Console Output

Enter the radius of the circle: 1.2 The radius is 1.2 The diameter is 2.4 The circumference is 7.5398223686155035 The area is 4.523893421169302
  • Write and document your program per class coding conventions.
  • Add an instance variable double radius. Generate its get/set methods.
  • Manually type the methods getDiameter(), getCircumference(), and getArea(). To calculate the circumference and area, use 3.14159 or the Java defined constant Math.PI
  • In main method, create a new instance of Assign3: Assign3 circle = new Assign3();
  • Create an instance of Scanner. Call print() to prompt the user to enter the radius. Call input.nextDouble() to get the user input. Call circle.setRadius() to set the radius.
  • Then call println() 4 times, each with the value of getRadius, getDiameter, getCircumference, getArea, respectively.
  • Use: setRadius(radius); String results = "Radius is " + getRadius() + ...; circleLabel.setText(results);

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

Neo4j Data Modeling

Authors: Steve Hoberman ,David Fauth

1st Edition

1634621913, 978-1634621915

More Books

Students also viewed these Databases questions

Question

The company has fair promotion/advancement policies.

Answered: 1 week ago