Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.text.DecimalFormat; public class CircleProperties { public static void main ( String [ ] args ) { double radius = 1 0 . 2 5

import java.text.DecimalFormat;
public class CircleProperties {
public static void main(String[] args){
double radius =10.25; //input radius
double diameter = radius *2; //calculate diameter
double circumference =3.1415* diameter; //calculate circumference
double area =3.1415* radius * radius; //calculate area
double semicircleArea = area /2; //calculate area of semicircle
DecimalFormat df = new DecimalFormat("#.#######");
System.out.println("Properties of a Circle");
System.out.println("Radius : "+ df.format(radius));
System.out.println("Diameter : "+ df.format(diameter));
System.out.println("Circumference : "+ df.format(circumference));
System.out.println("Area : "+ df.format(area));
System.out.println("Area of Semicircle : "+ df.format(semicircleArea));
System.out.println("
Properties \"Rounded\" Down");
System.out.println("Radius : "+(int) radius);
System.out.println("Diameter : "+(int) diameter);
System.out.println("Circumference : "+(int) circumference);
System.out.println("Area : "+(int) area);
System.out.println("Area of Semicircle : "+(int) semicircleArea);
}
}

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions