locked
How to calculate the amount due based on schedule?

    Question

  • My proffessor noticed I was doing pretty well in his VB course.

    He then suggested that I take a 4 credit Adv. VB course while taking his.

    Not to mention that is 9 weeks long!! I could figure it out by myself,

    but it would take me untold hours debuging it!!

     

     

    Im lost! Can someone please break down the steps to the problem below:

     

     

     

    Presentation Tier

     

    Main Form

    Include text boxes for the customer name, phone number, number traveling, departure date, and credit card number.

    Include a list box for the destination:Caribbean, Mediterrranean, and Alaska. Include radio buttons for 7-day or 14-day packages and a check box for first class. Validate that the user has made an entry for all fields.

     

    Summary Form

    Display the total billing amount, the total number traveling, the number for each

    destination, and the number of first-class fares.

     

    Business Tier (Do I creat another application in the Add Item menu? If so do I choose Class or WindowsForm?)

    Calculate the amount due based on the following schedule:

     

     

    Days                                Destination                               Standard Price                               First-Class Price

    7                                        Caribean                                      3250                                                 5000

    14                                       Caribean                                     6000                                                 9000

    7                                      Mediterranean                                4250                                                 7999

    14                                    Mediterranean                                7999                                                11999

     

     

     

    Sunday, November 09, 2008 1:59 AM

Answers

  • Ok, Simply

     

    Make a class "MySummary" another "SummaryEnigine"

     

    Code Snippet

    Public Class MySummary

    Private _Days As Integer = 1

    Private _Destination As String = "Empty"

    Private _StandardPrice As Double = 0

    Private _FirstClassPrice As Double = 0

     

    Public Property Days As Integer

    Get

    Return _Days

    End Get

    Set( Byval Value As Integer )

    _Days = Value

    End Set

    End Property

     

    Public Property Destination As String

    Get

    Return _Destination

    End Get

    Set( Byval Value As String )

    _Destination = Value

    End Set

    End Property

     

    Public Property FirstClassPrice As Double

    Get

    Return _FirstClassPrice

    End Get

    Set( Byval Value As Double)

    _FirstClassPrice = Value

    End Set

    End Property

    Public Property StandardPrice As Double

    Get

    Return _StandardPrice

    End Get

    Set( Byval Value As Double)

    _StandardPrice = Value

    End Set

    End Property

     

    End Class

     

    Public Class SummaryEnigine

    Private _MySummary(0) As MySummary

    Private _Count As Integer = 0

     

    Public Sub AddSummary( Byval Days As Integer, Byval Destination As String, Byval StandardPrice As Double, Byval FirstClassPrice As Double )

    Array.Resize( _MySummary, _Count + 1 )

    Dim NSummary As MySummary

    NSummary.Days = Days : NSummary.Destination = Destination : NSummary.StandardPrice = StandardPrice : NSummary.FirstClassPrice = FirstClassPrice

    _MySummary( Count ) = NSummary

    _Count += 1

    End Sub

     

    Public Function GetSummary( Byval Index As Integer) As MySummary

    If Not Index > ( _MySummary.Length - 1 ) Then

    Return _MySummary( Index )

    Else

    Throw New Exception( "Index was out of range" )

    End If

    End Function

     

    End Class

     

     

    Sunday, November 09, 2008 2:50 AM

All replies

  • can you tell me ( the relation of that ^^^ ) <> will the price be calculated by some discounts ( as the destination or ( there's no condition ) )

     

    Sunday, November 09, 2008 2:24 AM
  • Ok, Simply

     

    Make a class "MySummary" another "SummaryEnigine"

     

    Code Snippet

    Public Class MySummary

    Private _Days As Integer = 1

    Private _Destination As String = "Empty"

    Private _StandardPrice As Double = 0

    Private _FirstClassPrice As Double = 0

     

    Public Property Days As Integer

    Get

    Return _Days

    End Get

    Set( Byval Value As Integer )

    _Days = Value

    End Set

    End Property

     

    Public Property Destination As String

    Get

    Return _Destination

    End Get

    Set( Byval Value As String )

    _Destination = Value

    End Set

    End Property

     

    Public Property FirstClassPrice As Double

    Get

    Return _FirstClassPrice

    End Get

    Set( Byval Value As Double)

    _FirstClassPrice = Value

    End Set

    End Property

    Public Property StandardPrice As Double

    Get

    Return _StandardPrice

    End Get

    Set( Byval Value As Double)

    _StandardPrice = Value

    End Set

    End Property

     

    End Class

     

    Public Class SummaryEnigine

    Private _MySummary(0) As MySummary

    Private _Count As Integer = 0

     

    Public Sub AddSummary( Byval Days As Integer, Byval Destination As String, Byval StandardPrice As Double, Byval FirstClassPrice As Double )

    Array.Resize( _MySummary, _Count + 1 )

    Dim NSummary As MySummary

    NSummary.Days = Days : NSummary.Destination = Destination : NSummary.StandardPrice = StandardPrice : NSummary.FirstClassPrice = FirstClassPrice

    _MySummary( Count ) = NSummary

    _Count += 1

    End Sub

     

    Public Function GetSummary( Byval Index As Integer) As MySummary

    If Not Index > ( _MySummary.Length - 1 ) Then

    Return _MySummary( Index )

    Else

    Throw New Exception( "Index was out of range" )

    End If

    End Function

     

    End Class

     

     

    Sunday, November 09, 2008 2:50 AM