You should create a class named Rectangle with the following properties:
Width : A single
Length : A single
Area : A single
The Area property should be read-only. Provide a method named CalcArea that calculates widthxlength and stores the result in the Area property.
Next, create a class named Carpet with the following properties:
Color: A string
Style: A string
Price: A decimal
Here is the code I have so far...
Public Class Form1 Public Class Rectangle 'member variable Private sngWidth As Single 'holds width Private sngLength As Single 'holds height Private sngArea As Single 'holds area 'constructor Public Sub New() sngWidth = CSng(String.Empty) sngLength = CSng(String.Empty) sngArea = CSng(String.Empty) End Sub 'Width property procedure Public Property Width() As Single Get Return sngWidth End Get Set(value As Single) sngWidth = value End Set End Property 'Height property procedure Public Property Length() As Single Get Return sngLength End Get Set(value As Single) sngLength = value End Set End Property 'Area calculation is read-only Public ReadOnly Property Area() As Single Get 'calculation for area Dim sngArea As Single 'Determine area of room End Get End Property End Class End Class
Am I even close to on the right track?? I am trying to take code from the book and manipulate it as I do NOT understand this AT all!
I have no clue how to do the CalcArea portion either. Any tips on that would be greatly appreciated!