Clase Pedidos Ejercicio VB.Net - Curso de Programación Visual Basic

 Ejercicio

Clase Pedidos

Objetivo

Con Visual Studio, cree un proyecto y las clases correspondientes (con varios archivos) para este diagrama de clases.

Cada clase debe incluir los atributos y métodos mostrados en el diagrama. Considera que todas las cardinalidades son 1:1.

Código

Imports System
Namespace Orders
    Class Customer
        Public Sub New()
            name = ""
            address = ""
        End Sub

        Protected name As String
        Protected address As String
        Protected o As Order()
    End Class
End Namespace

Namespace Orders
    Class Item
        Inherits OrderDetail

        Public Sub New()
            shippingWeight = ""
            description = ""
        End Sub

        Protected shippingWeight As String
        Protected description As String

        Public Function getPriceForQuantity() As Double
            Return 0
        End Function

        Public Function getWeight() As Double
            Return 0
        End Function

        Public Function GetShippingWeight() As String
            Return shippingWeight
        End Function

        Public Function GetDescription() As String
            Return description
        End Function

        Public Sub SetShippingWeight(ByVal shippingWeight As String)
            Me.shippingWeight = shippingWeight
        End Sub

        Public Sub SetDescription(ByVal description As String)
            Me.description = description
        End Sub
    End Class
End Namespace

Namespace Orders
    Class Order
        Public Sub New()
            status = ""
        End Sub

        Protected date As DateTime
        Protected status As String
        Protected o As OrderDetail()

        Public Function calcTax() As Double
            Return 0
        End Function

        Public Function calcTotal() As Double
            Return 0
        End Function

        Public Function calcTotalWeight() As Double
            Return 0
        End Function

        Public Function GetDate() As DateTime
            Return date
        End Function

        Public Function GetStatus() As String
            Return status
        End Function

        Public Sub SetDate(ByVal date As DateTime)
            Me.date = date
        End Sub

        Public Sub SetStatus(ByVal status As String)
            Me.status = status
        End Sub
    End Class
End Namespace

Namespace Orders
    Class OrderDetail
        Public Sub New()
            quantity = 0.0
            taxStatus = ""
        End Sub

        Protected i As Item()
        Protected quantity As Double
        Protected taxStatus As String

        Public Function calcSubTotal() As Double
            Return 0
        End Function

        Public Function calcWeight() As Double
            Return 0
        End Function
    End Class
End Namespace

Juan A. Ripoll - Tutoriales de Sistemas y Cursos de Programación© 2024 Todos los derechos reservados.  Condiciones legales.