Cerinte aplicatie + rez

  • Published on
    14-Jul-2016

  • View
    13

  • Download
    0

Embed Size (px)

DESCRIPTION

jhg

Transcript

Aplicaie

S se construiasc o aplicaie n VB.NET, care s implementeze urmtoarele clase: 1. Factura, cu urmtoarea structur:a) Proprietati (publice): Numar () Data (>1/1/2013) Valoare (0) CotaTVA(accept numai valorile 0, 0.09 si 0.24)b) Metoda (public): ValoareCuTVA() - returneaz valoarea cu TVA a unei facturi 2. Facturi, cu urmtorii membri de clas (shared) publici:a) Atribut : colFacturi (ArrayList) - va conine obiecte de tip Facturab) Metode : TotalFacturi() - returneaz valoarea cu TVA a tuturor facturilor din colFacturi FacturaMax()- returneaz factura, din colFacturi, cu valoarea cea mai mare.

Aplicaia trebuie s conin i un formular care s permit instanierea clasei Factur i adugarea obiectelor respective n colecia colFacturi a clasei Facturi.

Public Class Factura Private mNumar As String Private mData As Date Private mValoare As Decimal Private mCotaTVA As Decimal

Public Property Numar As String Get Return mNumar End Get Set(value As String) If value "" Then mNumar = value Else MsgBox("Numar eronat !") End If End Set End Property

Public Property Valoare As Decimal Get Return mValoare End Get Set(value As Decimal) If value 0 Then mValoare = value Else MsgBox("Valoare eronata !") End If End Set End Property

Public Property Data As Date Get Return mData End Get Set(value As Date) If value > #1/1/2013# Then mData = value Else MsgBox("Data eronata !") End If End Set End Property

Public Property CotaTVA As Decimal Get Return mCotaTVA End Get Set(value As Decimal) If value = 0 Or value = 0.09 Or value = 0.24 Then mCotaTVA = value Else MsgBox("TVA eronata !") End If End Set End Property

Public Function ValoareCuTVA() As Decimal Return mValoare * (1 + mCotaTVA) End Function

End Class

Public Class Facturi Public Shared colFacturi As ArrayList = New ArrayList

Public Shared Function TotalFacturi() As Decimal Dim total As Decimal

For Each fact As Factura In colFacturi total = total + fact.ValoareCuTVA Next

Return total End Function

Public Shared Function FacturaMax() As Factura Dim fMax As Factura

If colFacturi.Count = 0 Then Return Nothing

fMax = colFacturi.Item(0)

For Each f As Factura In colFacturi If f.ValoareCuTVA > fMax.ValoareCuTVA Then fMax = f End If Next

Return fMax

End Function Private newPropertyValue As String Public Property NewProperty() As String Get Return newPropertyValue End Get Set(ByVal value As String) newPropertyValue = value End Set End Property

End Class

conf. Cozgarea Adrian