' ++++++++++++++++++++++++++++ Klasa Apartment ++++++++++++++++++++++++

Public Class Apartment
  Inherits Building
  Implements ISnowRemoval      ' Tutaj "podpisujemy umowę" z VB .NET...

  Private mUnits As Integer    ' Liczba mieszkań
  Private mRent As Double      ' Cena najmu jednostki
  Private mOccupRate As Double ' Współczynnik zajęcia budynków

  Public Sub New()

  End Sub

  ' Konstruktor z inicjalizującą listą argumentów
  Public Sub New(ByVal Addr As String, ByVal Price As Double, _
            ByVal Payment As Double, ByVal Taxes As Double, _
            ByVal Bldg As Integer, ByVal SnowPhone As String)
    MyBase.Address = Addr
    MyBase.PurchasePrice = Price
    MyBase.MonthlyPayment = Payment
    MyBase.Taxes = Taxes
    MyBase.BuildingType = Bldg
    If SnowPhone = "" Then
      MyBase.SnowRemoval = APTPHONE
    Else
      MyBase.SnowRemoval = SnowPhone
    End If
  End Sub
  ' ==================== Właściwości ======================

  Public Property Units() As Integer   ' Liczba mieszkań
    Get
      Return mUnits
    End Get
    Set(ByVal Value As Integer)
      mUnits = Value
    End Set
  End Property

  Public Property Rents() As Double   ' Cena najmu
    Get
      Return mRent
    End Get
    Set(ByVal Value As Double)
      mRent = Value
    End Set
  End Property

  Public Property OccupancyRate() As Double ' Współczynnik zajęcia
    Get
      Return mOccupRate
    End Get
    Set(ByVal Value As Double)
      mOccupRate = Value
    End Set
  End Property

  ' ============== Metody ==================

  ' Tutaj wypełniamy naszą umowę z Visual Basic .NET...
  Public Function CallSnowRemoval() As String Implements _
                    ISnowRemoval.CallSnowRemoval
    ' Cel: ta procedura jest wywoływana, aby usunąć śnieg przed blokiem.
    '    
    Return "Apartment snow removal: " & MyBase.SnowRemoval
  End Function

  Public Sub DisplayBuilding()

    DisplayBaseInfo()
    Console.WriteLine("Apartment members:")
    Console.WriteLine("Number of Units: " & mUnits)
    Console.WriteLine("Rent per Unit: " & FormatMoney(mRent))
    Console.WriteLine("Occupancy Rate: " & mOccupRate)
  End Sub
End Class
