Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

Write a program to input choice (1 or 2) if choice is 1 print the area of a circle otherwise print the perimeter of circle accept the radius of circle from




This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
I am writing the program in JAVA.

import java.util.Scanner;

public class Choice {

public static void main(String[] args) {

     int a, r;
     double A, P;
     Scanner in = new Scanner(System.in);
     System.out.println("Enter radius of circle");
     r = in.nextInt();
     System.out.println("Enter '1' for area of circle and '2' for perimeter");
     a = in.nextInt();
         case 1:
              System.out.println("The area of the cirlce is " + A + " square units.");
        case 2:
              System.out.println("The area of the cirlce is " + P + " units.");
            System.out.println("Please enter either 1 or 2.");
2 4 2
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts