using switch case statement write a program to find the volume of different solids bu taking suitable variables and data types
Answers
OK,
import java.util.*;
class Ankit
{
public static void main(String args[])
{
Scanner obj = new Scanner (System.in);
System.out.println("Enter your choice :- 1 for cone 2 for cuboid");
int n= obj.nextInt();
switch(n)
{
case 1 :
..................................YOUR BODY..........................
break;
case 2:
..................................Your BODY .............................
break;
default:
System.out.println("INVALID OPTION");
}
}
}
Hope it helps;
IN YOUR BODY just write the basic function to get volume..
Answer:import java.util.*;
class Ankit
{
public static void main(String args[])
{
Scanner obj = new Scanner (System.in);
System.out.println("Enter your choice :- 1 for cone 2 for cuboid");
int n= obj.nextInt();
switch(n)
{
case 1 :
..................................YOUR BODY..........................
break;
case 2:
..................................Your BODY .............................
break;
default:
System.out.println("INVALID OPTION");
}
}
}
Read more on Brainly.in - https://brainly.in/question/9491236#readmore