Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

DESCRIPTION Complete the program to calculate and print the circumference and area of a circle, rounded to the nearest tenth (1 decimal place). The starter

DESCRIPTION Complete the program to calculate and print the circumference and area of a circle, rounded to the nearest tenth (1 decimal place). The starter code already prompts the user and takes in the radius as a double-value input. You need to do the calculations and print the results. I recommend using the printf() command (described in chapter 3 of the book) to print the results with the correct rounding.

Sample output:

Enter the radius of a circle in centimeters: 5

Circumference = 31.4 cm

Area = 78.5 cm^2

Started code

//Must use printf()

import java.util.Scanner;

class Circle {

static Scanner sc = new Scanner(System.in); public static void main(String args[]) { System.out.print("Enter radius of circle in centimeters:"); double radius = sc.nextDouble();

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_2

Step: 3

blur-text-image_3

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students explore these related Databases questions