using
System;
System.Collections.Generic;
SC = System.Console;
System.Linq;
System.Text;
public
class abc
{
public static void Main()
String continueStr = "Y";
double side, length;
while (continueStr.ToUpper()!="N")
SC.Write("\nEnter the value for side ");
side =
Convert.ToDouble(SC.ReadLine());
while (side < 0)
SC.WriteLine("The side may not be Negative! Please re-enter");
SC.Write("Enter the value for side ");
}
SC.Write("\nEnter the value for length ");
length =
while (length < 0)
SC.WriteLine("The width may not be Negative! Please re-enter");
SC.Write("Enter the value for length ");
if (length == 0 && side == 0 )
Prism myPrism = new Prism(side, length);
myPrism.displayData();
else if (length >= 0 && side >= 0 )
SC.Write("\nWould you like to enter more data (Y/N) ");
continueStr =
SC.ReadLine();
// end of Main method
// end of Main class
class Square
private double side; //in a square, both sides are the same
public Square ()
// default constructor
side = 7;
public Square (double s)
{ side = s;
public double getSide() // a getter method
return side;
public double findArea()
return (side * side);
// see the next page for more
class Prism : Square
private double side;
private double length;
public Prism():base()
length = 10;
//default constructor
public Prism(double s, double l):base(s)
length = l;
// non-default constructor
new public double findArea()
double surfaceArea;
surfaceArea =
base.findArea();
Math.Round((((5.1 / 2) * (5.1 / 2)) + (9.2 * 9.2)),2);
return Math.Round((2 * surfaceArea) + (5.1 * 6.7) + (2 * (getSide() * 6.7)), 2);
//???
public double volume()
return Math.Round(findArea() * length,2) ;
public void displayData()
SC.WriteLine("\nThe side of the Prism is {0,5}",
Math.Round(side, 2).ToString("F2"));
SC.WriteLine("\nThe length of the Prism is {0,9}",
Math.Round(length, 2).ToString("F2"));
//SC.WriteLine("\nThe Volume is