Request that the user enter the radius of a circle from the keyboard and store the value entered in the double variable, radius.
1
Expert's answer
2017-03-09T09:46:06-0500
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); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment