Public Class ProfitsOrLosses ‘variables Private revenues As Integer Private expe
ID: 3634347 • Letter: P
Question
Public Class ProfitsOrLosses‘variables
Private revenues As Integer
Private expenses As Integer
‘properties
Public Property Revenues() As Integer
Get
Return revenues
End Get
Set(ByVal Value As Integer)
revenues = Value
End Set
End Property
Public Property Expenses() As Integer
Get
Return expenses
End Get
Set(ByVal Value As Integer)
expenses = Value
End Set
End Property
‘methods
Public Sub New()
revenues = 0
expenses = 0
End Sub
Public Function CalculateProfitsOrLosses() As Integer
Return revenues - expenses
End Function
End Class
- Write a Dim statement that creates a ProfitsOrLosses object and assigns its address to a variable named March2007.
- Write an assignment statement that uses the ProfitsOrLosses object created in Step a to assign the number 35890 to the revenues variable.
- Write an assignment statement that uses the ProfitsOrLosses object created in Step a to assign the number 28468 to the expenses variable.
- Write an assignment statement that uses the ProfitsOrLosses object created in Step a to call the CalculateProfitsOrLosses method. Assign the methods's return value to a variable named profitsOrLosses.
Explanation / Answer
Dear, 1- Dim March2007 As New ProfitsOrLosses 2- March2007.Revenues = 35890 3- March2007.Expenses = 28468 4- Console.Write(March2007.CalculateProfitsOrLosses()) Hope this will help you..
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.