Answers

2015-11-08T14:03:53+05:30

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();
     in.close();
 
   
  switch(a){
         case 1:
              A=3.14*r*r;
              System.out.println("The area of the cirlce is " + A + " square units.");
              break;
        case 2:
              P=2*3.14*r;
              System.out.println("The area of the cirlce is " + P + " units.");
              break;
       default:
 
            System.out.println("Please enter either 1 or 2.");
              break;
       }
}
}
2 4 2