Question: Question 2 Write a Java program that reads radius (r) and height (h) of a cone (a shape like given below figure), and calculates its
Question 2 Write a Java program that reads radius (r) and height (h) of a cone (a shape like given below figure), and calculates its volume using the below given formula. (You should define T as 3.14.) rah Volume cone = 3 Note: Radius and height values might be decimal numbers. Therefore, you should get these values from user by using nextDouble() method. Analyze the sample given below and write your codes accordingly. Ilread the value of radius System.out.print("Radius of the cone: "); r = keyboard.nextDouble(): Note: You must use casting conversion to print the volume as an integer. Sample Output: Radius of the cone: 8 Height of the cone: 12 Volume of the cone is 8e3. Volume of Cone
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
