You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 17, 2024. It is now read-only.
Write a menu-driven program to calculate the area of a circle, or the perimeter, after entering the choice and radius (choice to be entered in character).
26/04/23 */
importjava.util.Scanner;
publicclassProgram31 {
publicstaticvoidmain() {
Scannersc = newScanner(System.in);
System.out.println("Enter your choice:\na. Area of circle\nb. Perimeter of circle");
charchoice = sc.next().charAt(0);
System.out.print("Enter the radius of the circle: ");
doubler = sc.nextDouble();
switch (choice) {
case'a': case'A':
doubleres = 3.14 * r * r;
System.out.println("The area of the circle is " + res);
break;
case'b': case'B':
res = 6.28 * r;
System.out.println("The perimeter of the circle is " + res);