+ 1

where the worng in my pro

class Program { public static void Main(string[] args) { double r, h, b; Console.WriteLine("Enter the radius of cone"); r = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the Height of cone"); h = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the radius of pyramid"); b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the Height of pyramid"); h = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the radius of sphere"); r = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("The volume of the cone is:" + Vol()); Console.WriteLine("The volume of the pyramid is:" + Vol()); Console.WriteLine("The volume of the sphere is :" + Vol()); } public static double Vol(double r,double h) { double cal; return cal =( 1.0 / 3.0 )* Math.PI * (r * r )* h; } public static double Vol(int b, double h) { double cal; return cal = (1.0 / 3.0) * b * h; } public static double Vol(double r) { double cal; return cal = (4.0 / 3.0) * Math.PI *( r * r * r); } }

17th Nov 2019, 9:05 PM
Khaled Saleh
Khaled Saleh - avatar
4 Answers
+ 3
Additionally, you ideally should tag the language relevant with your question (C#). So next time please make sure you don't forget to put only words that are relevant with your question. This tips may help, for future reference 👍 https://www.sololearn.com/Discuss/333866/?ref=app
18th Nov 2019, 4:45 AM
Ipang
+ 1
The code looks good. The error is you do not fill in the parameters for the method Vol() Vol(parameters have to go in here!) Console.WriteLine("The volume of the cone is:" + Vol()); Console.WriteLine("The volume of the pyramid is:" + Vol()); Console.WriteLine("The volume of the sphere is :" + Vol()); Please try to paste code via link in the playground. Please put the language you use in the tags. Please use usefull tags
17th Nov 2019, 10:13 PM
sneeze
sneeze - avatar
+ 1
đŸ€Ż u cant redifine method Vol
17th Nov 2019, 11:11 PM
Eotd Pro
Eotd Pro - avatar
+ 1
Keep going, you are doing great. Keep coding, keep asking
17th Nov 2019, 11:13 PM
sneeze
sneeze - avatar