Actual Expected : 4.500000 Enter the radius (between 0.0 and 500.0, exclusive): The radius Enter the radius (between 0.0 and 500.0, exclusive): The radius The circle circumference : 28.274334 The circle area : 4.500000. The circle circumference: 28.274334. The circle area The sphere surface area : 254.469005. The sphere volume : 63.617251 : 63.617251. The sphere surface area : 254.469005 The sphere volume : 381.703507 : 381.703507. fail Test 2 Input: -1 0.01 Actual Expected Enter the radius (between 0.0 and 500.0, exclusive): The radius : 0.000000 Enter the radius (between 0.0 and 500.0, exclusive): The input number 0.00 is out of range. Enter the radius (between 0.0 and 500.0, exclusive): The input number -1.00 is out of range. Enter the radius (between 0.0 and 500.0, exclusive): The radius The circle circumference: 0.062832. The circle area The sphere surface area : 0.001257. The sphere volume The circle circumference: 0.000000 The circle area : θ.010000. The sphere surface area The sphere volume : 0.000000 : θ.000000 : 0.000000 : 0.000314. : θ.000θ04. fail Test 3 Input: 501 500.0 499.99 Expected

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please fix this code: Make it look like the EXPECTED PICTURE ( the read is wrong)
4.5
Actual
Expected
: 4.500000 Enter the radius (between 0.0 and 500.0, exclusive): The radius
Enter the radius (between 0.0 and 500.0, exclusive): The radius
The circle circumference : 28.274334
The circle area
: 4.500000.
The circle circumference: 28.274334.
: 63.617251
The sphere surface area: 254.469005
: 381.703507
: 63.617251.
The sphere surface area : 254.469005.
: 381.703507.
The circle area
The sphere volume
The sphere volume
fail
Test 2
Input:
-1
0.01
Actual
Expected
Enter the radius (between 0.0 and 500.0, exclusive): The radius
: 0.000000 Enter the radius (between 0.0 and 500.0, exclusive): The input number 0.00 is out of range.
Enter the radius (between 0.0 and 500.0, exclusive): The input number -1.00 is out of range.
Enter the radius (between 0.0 and 500.0, exclusive): The radius
The circle circumference: 0.062832.
The circle area
The circle circumference: 0.000000
The circle area
: 0.000000
: 0.010000.
The sphere surface area : 0.000000
The sphere volume
: θ.00000
: 0.000314.
The sphere surface area : 0.001257.
The sphere volume
: 0.000004.
fail
Test 3
Input:
501
500.0
499.99
Exnected
Actual
Sha
Transcribed Image Text:4.5 Actual Expected : 4.500000 Enter the radius (between 0.0 and 500.0, exclusive): The radius Enter the radius (between 0.0 and 500.0, exclusive): The radius The circle circumference : 28.274334 The circle area : 4.500000. The circle circumference: 28.274334. : 63.617251 The sphere surface area: 254.469005 : 381.703507 : 63.617251. The sphere surface area : 254.469005. : 381.703507. The circle area The sphere volume The sphere volume fail Test 2 Input: -1 0.01 Actual Expected Enter the radius (between 0.0 and 500.0, exclusive): The radius : 0.000000 Enter the radius (between 0.0 and 500.0, exclusive): The input number 0.00 is out of range. Enter the radius (between 0.0 and 500.0, exclusive): The input number -1.00 is out of range. Enter the radius (between 0.0 and 500.0, exclusive): The radius The circle circumference: 0.062832. The circle area The circle circumference: 0.000000 The circle area : 0.000000 : 0.010000. The sphere surface area : 0.000000 The sphere volume : θ.00000 : 0.000314. The sphere surface area : 0.001257. The sphere volume : 0.000004. fail Test 3 Input: 501 500.0 499.99 Exnected Actual Sha
4
public class CircleAndSphereWhileLoop
public static final double MAX RADIUS = 500.0;
public static final double MIN RADIUS = 0.0;
7
8
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter the»radius (between 0.0 and 500.0, exclusive): ");
double radius = in.nextDouble();
10
11
12
13
while(radius < 0.00 || radius > 500.00){
System.out.println("The Input number -1.00 is out of range");
14
15
16
17
System.out.println("Enter the radius (between 0.0 and 500.0, exclusive) :");
radius = in.nextDouble();
18
19
20
}
21
22
23
double circumference = 2*Math.PI*radius;
double area = Math.PI * radius * radius;
double surfaceArea = 4 * Math.PI * Math.pow(radius, 2);
double volume = (4/ 3.0) * Math.PI * Math.pow(radius,3);
24
25
26
27
System.out.println (String.format("The radius
System.out.println (String.format("The circle circumference : %.6f",circumference));
System.out.println(String.format("The circle area
System.out.println(String.format("The sphere surface area
System.out.println(String.format("The sphere volume
28
: 8.6f", radius));
29
: 8.6f", area));
: 8.6f", surfaceArea));
: %.6f", volume));
30
31
32
33
34
35
Transcribed Image Text:4 public class CircleAndSphereWhileLoop public static final double MAX RADIUS = 500.0; public static final double MIN RADIUS = 0.0; 7 8 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the»radius (between 0.0 and 500.0, exclusive): "); double radius = in.nextDouble(); 10 11 12 13 while(radius < 0.00 || radius > 500.00){ System.out.println("The Input number -1.00 is out of range"); 14 15 16 17 System.out.println("Enter the radius (between 0.0 and 500.0, exclusive) :"); radius = in.nextDouble(); 18 19 20 } 21 22 23 double circumference = 2*Math.PI*radius; double area = Math.PI * radius * radius; double surfaceArea = 4 * Math.PI * Math.pow(radius, 2); double volume = (4/ 3.0) * Math.PI * Math.pow(radius,3); 24 25 26 27 System.out.println (String.format("The radius System.out.println (String.format("The circle circumference : %.6f",circumference)); System.out.println(String.format("The circle area System.out.println(String.format("The sphere surface area System.out.println(String.format("The sphere volume 28 : 8.6f", radius)); 29 : 8.6f", area)); : 8.6f", surfaceArea)); : %.6f", volume)); 30 31 32 33 34 35
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY