Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Public Class Product Public Property Name() As String Public Event PriceChanged(

ID: 3530351 • Letter: P

Question

Public Class Product

Public Property Name() As String

Public Event PriceChanged()

Private _price As Decimal

Public Property Price() As Decimal

Get

Return _price

End Get

Set(ByVal value As Decimal)

_price = value

' Fire the event to all listeners.

RaiseEvent PriceChanged()

End Set

End Property

Public Property ImageUrl() As String

Public Function GetHtml() As String

Dim htmlString As String

htmlString = "<h1>" & Name & "</h1><br />"

htmlString &= "<h3>Costs: " & Price.ToString() & "</h3><br />"

htmlString &= "<img src=""</span><span class="c4">&amp; ImageUrl &amp;</span> <span class="c6">"" />"

Return htmlString

End Function

Public Sub New(ByVal name As String, ByVal price As Decimal)

Me.Name = name

Me.Price = price

End Sub

Public Sub New(ByVal name As String, ByVal price As Decimal, _

ByVal imageUrl As String)

Me.Name = name

Me.Price = price

Me.ImageUrl = imageUrl

End Sub

End Class

Create a class called MyClass. Add a property called name.


Add a constructor to the class that sets the value of name to the name that is passed into the constructor.


Add a method called "AddNumbers" that accepts 2 numbers as parameters, adds them and returns the result.


Add a method called "FindTrianglarNumber" that accepts an integer and that will add all numbers between 1 and that number and returns the result using a for loop.


On the default.aspx page under the page load method, create a new instance of MyClass and do a response.write in order to display the results to the screen

Explanation / Answer

Public Class MyClass Private name As String // property // below is constructor Property MyClass() As String Get Return name End Get Set(ByVal Value As String) name= Value End Set End Property Public Function AddNumbers(ByVal num1 As String,ByVal num2 As String) As String int sum sum=Convert.ToInt32(num1)+Convert.ToInt(num2) Return sum End Function End Class rate if it helps

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote