Write a program that asks the user \"What is the circle radius?\", then creates
ID: 3869208 • Letter: W
Question
Write a program that asks the user "What is the circle radius?", then creates a new circle with that radius. If the area of the circle is >= 10, then print the message "This circle is big." otherwise print the message "This circle is small." taking note that the message has a fullstop at the end of the sentence.
The following sample I/O shows how your program should behave for a big circle:
And for a small circle:
public class Exercise4 {
public static void main(String[] args) {
// INSERT YOUR CODE HERE
}
}
Explanation / Answer
Exercise4.java
import java.util.Scanner;
public class Exercise4 {
public static void main(String[] args) {
// INSERT YOUR CODE HERE
Scanner scan = new Scanner(System.in);
System.out.println("What is the circle radius? ");
double radius = scan.nextDouble();
if(radius>=10) {
System.out.println("This circle is big.");
} else {
System.out.println("This circle is small.");
}
}
}
Output:
What is the circle radius?
12.2
This circle is big.
What is the circle radius?
1.2
This circle is small.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.