Answered by:
c#

Question
-
John is a software developer, who works for Mega Technologies. He is currently under the project
of geometric calculations. The program that John has to develop should:
Calculate the area of circle.
Calculate the volume of the cube.
Help John to develop the program using an interface.
Answers
-
Hi
public interface IShape { double Volume(); double Area(); } class Circle : IShape { public int radius { get; set; } public double Volume() { return (4 / 3) * Math.PI * radius * radius * radius; } public double Area() { return Math.PI * radius * radius; } }
Refer Article
Regards
- Marked as answer by Bob ShenModerator Tuesday, June 4, 2013 9:32 AM
-
You build form 1 with two buttons "Area for Circle" and "Volume for Cube" and link them to their respective forms.
Then take text box(or whatever you may like) as user's entry field for radius and calculate the area of the respective figure.
You can also do this in a single page taking the radius, and keeping two radio buttons for circle and for Cube, one button "Calculate" and another field to show result.
- Edited by D. Chatterjee Tuesday, May 14, 2013 1:34 AM
- Marked as answer by Bob ShenModerator Tuesday, June 4, 2013 9:32 AM
All replies
-
-
Paul, do you really want to be doing the guy's homework for him?
He could ask specific questions here about interfaces and we'd be happy to help him out here, so that it will benefit others. By asking him to contact you via email, you'll end up being suckered into writing his whole app for him, plus no one else here on the forums will benefit.
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
-
Bonnie, I'm not asking the original poster to contact me, I am asking John to contact me... If it is homework then John does not exist. If it is not homework then I will make sure that John from Mega Technologies posts any specific questions here, he may just need help in using the editor or creating an account on this site.
Paul Linton
-
-
Hi
public interface IShape { double Volume(); double Area(); } class Circle : IShape { public int radius { get; set; } public double Volume() { return (4 / 3) * Math.PI * radius * radius * radius; } public double Area() { return Math.PI * radius * radius; } }
Refer Article
Regards
- Marked as answer by Bob ShenModerator Tuesday, June 4, 2013 9:32 AM
-
-
You build form 1 with two buttons "Area for Circle" and "Volume for Cube" and link them to their respective forms.
Then take text box(or whatever you may like) as user's entry field for radius and calculate the area of the respective figure.
You can also do this in a single page taking the radius, and keeping two radio buttons for circle and for Cube, one button "Calculate" and another field to show result.
- Edited by D. Chatterjee Tuesday, May 14, 2013 1:34 AM
- Marked as answer by Bob ShenModerator Tuesday, June 4, 2013 9:32 AM
-
Bonnie, I'm not asking the original poster to contact me, I am asking John to contact me... If it is homework then John does not exist. If it is not homework then I will make sure that John from Mega Technologies posts any specific questions here, he may just need help in using the editor or creating an account on this site.
Clever, Paul! ;0)
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com