1 Replies - 378 Views - Last Post: 06 October 2012 - 10:43 AM Rate Topic: -----

#1 junior34pl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-March 12

HW Problem

Posted 06 October 2012 - 08:55 AM

Kenna’s Kandles offers candles in various shapes, scents, and colors.
Write an MDI project that contains a Main form, an About form, and a
Summary form using a separate tier for the business rules.
Presentation Tier
Main Form
• Text boxes for customer information (name and credit card number).
• Text box for quantity.
• Radio buttons or list box for candle style (tea light, votive, or pillar).
• Radio buttons or list box for color (Federal Blue, Sunflower Yellow,
Christmas Red, and Lily White).
• Check box for Scented.
• Label for the price of the item.
Summary Form
Display the subtotal for all candles, the tax of 8 percent, a shipping fee of
3 percent, and the total due.
Business Services Tier
Calculate the price for each candle based on the options selected. The
business services tier also should accumulate the information for the total.
Style Base price Scented price (additional)
Tea lights 5.75 0.75
Votives 7.50 1.25
Pillar 12.25 1.75

Can someone give me any hint how to calculate the order. Especially how to calculate the extra scanted charges.

'Program:  Kenna's Kamdles
'Programmer:  
'Date:  October 20012
'Description: Kenna’s Kandles offers candles in various shapes, scents, and colors. Write a multiple document project that contains a Main form, an About form, and a Summary form using
'            a separate tier for the business rules. 


Public Class Form1
    Private Const TeaLightsBase_Decimal As Decimal = 5.75D
    Private Const VoltivesBase_Decimal As Decimal = 7.2D
    Private Const PilarBase_Decimal As Decimal = 12.25D
    Private Const TeaLightsScented_Decimal As Decimal = 0.75D
    Private Const VoltivesScented_Decimal As Decimal = 1.25D
    Private Const PilarScented_Decimal As Decimal = 1.75D
    Private Const ShippingFee_Decimal As Decimal = 0.3D
    Private Const TaxRate_Decimal As Decimal = 0.8D

    Dim QuantityDecimal, SubtotalDecimal, StyleDecimal, ScentDecimal, TaxDecimal, TotalDecimal, ShippingDecimal As Decimal
    Dim MessageString As String


    ' Function

    Private Function FindTax(ByVal QuantityDecimal As Decimal, ByVal ScentDecimal As Decimal) As Decimal

        'Calculate the tax

        Return ((QuantityDecimal + StyleDecimal + ScentDecimal) * TaxRate_Decimal)



    End Function
    ' Functio
    Private Function FindShippingFee(ByVal SubtotalDecimal As Decimal) As Decimal

        'Calculate the Shipping fee

        Return ((TotalDecimal) * ShippingFee_Decimal)

    End Function

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
        'Exit the program
        Me.Close()
    End Sub

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        PriceLabel.Text = ""
        TealightsRadioButton.Checked = False
        VotivesRadioButton.Checked = False
        PilarRadioButton.Checked = False
        FederalBlueRadioButton.Checked = False
        SunflowerYellowRadioButton.Checked = False
        ChristmasRedRadioButton.Checked = False
        LilyWhiteRadioButton.Checked = False
        ScantedCheckBox.Checked = False
        QuantityTextBox.Text = ""
        CustomerNameTextBox.Text = ""
        CrediCardNumberTextBox.Text = ""



    End Sub

    Private Sub AddtoOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddtoOrderButton.Click

        Try
            QuantityDecimal = Decimal.Parse(QuantityTextBox.Text, Globalization.NumberStyles.Any)
        Finally
        End Try

        If
            QuantityDecimal = Decimal.Parse(QuantityTextBox.Text)  'Convert the Quantity
            'Include the base Scent chatges
            If TealightsRadioButton.Checked Then SubtotalDecimal += TeaLightsBase_Decimal
            If VotivesRadioButton.Checked Then SubtotalDecimal += VoltivesBase_Decimal
            If PilarRadioButton.Checked Then SubtotalDecimal += PilarBase_Decimal
        End If

        'Include the scanted charges.
        If ScantedCheckBox.Checked / TealightsRadioButton.checked then += TeaLightsScented_Decimal


    End Sub
End Class




Is This A Good Question/Topic? 0
  • +

Replies To: HW Problem

#2 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1046
  • View blog
  • Posts: 4,072
  • Joined: 02-July 08

Re: HW Problem

Posted 06 October 2012 - 10:43 AM

It would be the same math and logic as if you write it down on paper or write code. Try writing it down on paper then apply the same principals to your code. In code you do have it apply values from diff inputs - look into TryParse for checking for string that can convert into the appropriate datatype i.e. Integer or Double, if you gather data from textboxes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1