Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the code to output Radius is followed by the value of sphereRadius to three digits after the decimal point. On the next line,

Complete the code to output "Radius is " followed by the value of sphereRadius to three digits after the decimal point. On the next line, output "Volume is " followed by the value of sphereVol to five digits after the decimal point End with a newline.
Ex. If the input is 3.100, then the output is:
Radius is 3.100
Volume is 124.78825
Note: System out printf() can be used with "% Xf" to output a double to X digits after the decimal point.
import java.util.Scanner;
public class Sphere {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
double sphereRadius;
double sphereVol;
sphereRadius = scnr. nextDouble ();
sphereVol =(4.03.0)** Math.PI *(sphereRadius * sphereRadius * sphereRadius);
System.out.printf("Radius is", sphereRadius);
System.out.printlnf("Volume is", sphereVol); (* Your code goes here */
}
I
}
image text in transcribed

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

How is the recovery rate of a bond usually defined? AppendixLO1

Answered: 1 week ago