68 774
Assignments Done
Successfully Done
In January 2019

Answer to Question #66082 in Java | JSP | JSF for dave

Question #66082
Request that the user enter the radius of a circle from the keyboard and store the value entered in the double variable, radius.
Expert's answer
import java.util.Scanner;

public class Test {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
System.out.println("Enter the radius of a circle: ");
double radius;
do {
double temp = s.nextDouble();
radius = (temp < 0) ? -1 : temp;
if (radius == -1)
System.out.println("Enter the positive value");
} while (radius == -1);


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions