Lab #10

Lab #10 - Book Sale Application 

Submit Assignment View Application 

  • Be sure to include comments at the top of each procedure and at the top of the file.
  • Be sure to use meaningful names for all buttons and labels. 
  1. R 'n R has decided to start selling books online. Create a web site to calculate the amount due, including discounts. Allow the user to display the total of the discounts. 

    The user enters the quantity, title, and price of a book, and the program calculates the extended price, a 15 percent discount, and the discounted price.  

    The input must be validated. The quantity and price are required fields, and the quantity must be an integer between 1 and 100. 

    Additionally, the program will maintain a total of all discounts given and display that total on the page in response to a button cick.  

    Include a second page for contact information..


  2. Use a custom class for the BookSale including Title, Quantity, Price, ExtendedPrice, Discount

Class Text:


'Class Name: BookSale
'Programmer: Your Name
'Date: Today's Date
'Description: Handle book sale information.
'Project: Lab 9

Public Class BookSale
Private TitleString As String
Private QuantityInteger As Integer
Private PriceDecimal, ExtendedPriceDecimal As Decimal
Private DiscountDecimal, DiscountedPriceDecimal As Decimal

Const DISCOUNT_RATE_Decimal As Decimal = 0.15D



Public Sub New(ByVal TitleIn As String, ByVal QuantityIn As Integer,
ByVal PriceIn As Decimal)
' Assign the property Values.

Title = TitleIn
Quantity = QuantityIn
Price = PriceIn

' determine price
CalculateExtendedPrice()

' determine final price
CalculateDiscountedPrice

End Sub

Property Title() As String
Get
Return TitleString
End Get
Set(ByVal Value As String)
TitleString = Value
End Set
End Property

Property Quantity() As Integer
Get
Return QuantityInteger
End Get
Set(ByVal Value As Integer)
If Value >= 0 Then
QuantityInteger = Value
End If
End Set
End Property

Property Price() As Decimal
Get
Return PriceDecimal
End Get
Set(ByVal Value As Decimal)
If Value >= 0 Then
PriceDecimal = Value
End If
End Set
End Property

ReadOnly Property ExtendedPrice() As Decimal
Get
Return ExtendedPriceDecimal
End Get
End Property

ReadOnly Property Discount As Decimal
Get
Return DiscountDecimal
End Get
End Property
ReadOnly Property DiscountedPrice As Decimal
Get
Return DiscountedPriceDecimal
End Get
End Property


Protected Sub CalculateExtendedPrice()
' Calculate the extended price.

ExtendedPriceDecimal = Quantity * Price
End Sub

Protected Sub CalculateDiscountedPrice()
' Calculate the extended price.

DiscountDecimal = Quantity * Price * DISCOUNT_RATE_Decimal

DiscountedPriceDecimal = Quantity * Price - Discount
End Sub


End Class