Ejemplo n.º 1
0
        public double GetArea()
        {
            //Initialize PropmtUser() class
            PromptUser promptUser = new PromptUser();

            // Ask user for the length and width. The PropmtUser.GetDoubleFromUser() method contains logic that will only accept a double-type.
            double length = promptUser.GetDoubleFromUser("length");
            double width  = promptUser.GetDoubleFromUser("width");

            // Do math, return result
            double area = Convert.ToDouble(length * width);

            return(area);
        }
Ejemplo n.º 2
0
        public double GetArea()
        {
            //Initialize PropmtUser() class
            PromptUser promptUser = new PromptUser();

            // Get value of pi
            double pi = Math.PI;

            // Ask user for the radius. The PropmtUser.GetDoubleFromUser() method contains logic that will only accept a double-type.
            double radius = promptUser.GetDoubleFromUser("radius");

            // Do math, return result
            double area = (pi * (radius * radius));

            return(area);
        }