Caleb Adeyemo

Caleb Adeyemo

  • NA
  • 1
  • 2.1k

C# Program

Feb 15 2011 8:42 PM
Please I need help writing a complete Rectangle class which represents a common rectangle figure with four sides(two pairs of parallel opposite sides). The class is to have two variables- length and Width which may hold two values with decimal points. Two constructors are needed. The default contructor is to initialize length and width to 1.0 each. The second contructor must pass-in two values to initialize length and width. There has to be six methods to do the following:SetLength,SetWidth,GetLength,GetWidth,GetArea,andGetPerimeter. The perimeter is the sum of all sides of a rectangle. From the Program class, three instances of the Rectangle class are to be created. The first instance, named rectOne, must use the default construcion. The second instance, named rectTwo, must also use the default construction. The third instance,named rectThree, must use the parameter constructor with values of 20 for length and 30 for width. After rectTwo is created, the SetLength and SetWidth methods are to be used to set length to 10 and width to 15. For all three intances of the class, we need to print the length,width, area, and perimeter using proper methods.

Answers (1)