Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(please typed) A College Book Store is running a sale on Twentieth Century Ameri

ID: 3741003 • Letter: #

Question

(please typed)

A College Book Store is running a sale on Twentieth Century American novels during the first week in December. The College is hosting a huge convention of English Professors during that week. (The Convention is about Twentieth Century American Literature.) They need a special program to expedite the sale of novels they are featuring.

Students at the College (15%)

Faculty (20%)

College Staff Members (10%)

Other New Jersey College Students (10%)

In addition, you must include NJ tax in your calculations (6%), except for Faculty members, who pay no tax on class books.

Use a form menu to do the following:

calculate each individual book order

calculate a summary for several book orders

exit the application

When a title is selected from the list box, it should fill in the price for the selection in the designated text box. A message box should appear when no quantity is entered. The Student radio button should be selected (“checked”) as a default when the form first appears. The Extended Price should display final price with discounts and tax.

Twentieth Century American Citerature As I Lay D The Great Gatsby The Sound and the Fury The Old Man and the Sea M Discounts Student Faculty College Staff Book Store Employee NJ Student 12.99 23.41 R 'n R Book Sales Summary Sales Total: $34.42 Sales Count: 2 Total of Student Discounts: $3.90 OK Questions regarding this project will be answered in class. A demonstration will be provided as well

Explanation / Answer

Form1.vb:

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddBook.Click
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        Dim input As Boolean = False
        Dim number As Double
        Dim subtotal As Double
        Dim total As Double = 0
        Dim discount As Double = 1
        Dim tax As Double = 1.06

        If TypeCustomer.Text = "Student at the College" Then
            discount = 0.85
        End If
        If TypeCustomer.Text = "Faculty" Then
            discount = 0.8
            tax = 1
        End If
        If TypeCustomer.Text = "College Staff Member" Then
            discount = 0.9
        End If
        If TypeCustomer.Text = "Other New Jersey College Student" Then
            discount = 0.9
        End If

        msg = "You must input the price of the book"
        style = MsgBoxStyle.OkOnly
        title = "Input Price"   ' Define title.
        If (Price.Text.Length <= 0) Then
            input = False
        Else
            input = True
            number = Convert.ToDouble(Price.Text)
        End If
        If (number < 0 Or input = False) Then
            response = MsgBox(msg, style, title)
        Else
            subtotal = number * discount * tax
            If Totalprice.Text.Length > 0 Then
                total = Convert.ToDouble(Totalprice.Text) + subtotal
            Else
                total = subtotal
            End If
            Result.Text = Result.Text & Book.SelectedItem.ToString() & ". Price= " & subtotal & vbCrLf
            Totalprice.Text = total
        End If

    End Sub
End Class

Form1.Designer.vb:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form


    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub


    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Book = New System.Windows.Forms.ListBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.AddBook = New System.Windows.Forms.Button()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.TypeCustomer = New System.Windows.Forms.ListBox()
        Me.Price = New System.Windows.Forms.TextBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Result = New System.Windows.Forms.TextBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Totalprice = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(139, 21)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(183, 17)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "BOOK SALE CALCULATOR"
        '
        'Book
        '
        Me.Book.FormattingEnabled = True
        Me.Book.ItemHeight = 16
        Me.Book.Items.AddRange(New Object() {"The Great Gatsby", "The Old Man and the Sea", "As I Lay Dying", "The Sound and the Fury"})
        Me.Book.Location = New System.Drawing.Point(170, 120)
        Me.Book.Name = "Book"
        Me.Book.Size = New System.Drawing.Size(189, 68)
        Me.Book.TabIndex = 1
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(53, 143)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(85, 17)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Add a Book:"
        '
        'AddBook
        '
        Me.AddBook.Location = New System.Drawing.Point(385, 138)
        Me.AddBook.Name = "AddBook"
        Me.AddBook.Size = New System.Drawing.Size(66, 26)
        Me.AddBook.TabIndex = 3
        Me.AddBook.Text = "Add"
        Me.AddBook.UseVisualStyleBackColor = True
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(53, 78)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(122, 17)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Type of customer:"
        '
        'TypeCustomer
        '
        Me.TypeCustomer.FormattingEnabled = True
        Me.TypeCustomer.ItemHeight = 16
        Me.TypeCustomer.Items.AddRange(New Object() {"None", "Student at the College", "Faculty", "College Staff Member", "Other New Jersey College Student"})
        Me.TypeCustomer.Location = New System.Drawing.Point(244, 75)
        Me.TypeCustomer.Name = "TypeCustomer"
        Me.TypeCustomer.Size = New System.Drawing.Size(189, 20)
        Me.TypeCustomer.TabIndex = 4
        '
        'Price
        '
        Me.Price.Location = New System.Drawing.Point(244, 207)
        Me.Price.Name = "Price"
        Me.Price.Size = New System.Drawing.Size(186, 22)
        Me.Price.TabIndex = 6
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(49, 207)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(139, 17)
        Me.Label4.TabIndex = 7
        Me.Label4.Text = "Input the Book Price:"
        '
        'Result
        '
        Me.Result.AcceptsReturn = True
        Me.Result.Location = New System.Drawing.Point(56, 262)
        Me.Result.Multiline = True
        Me.Result.Name = "Result"
        Me.Result.ReadOnly = True
        Me.Result.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.Result.Size = New System.Drawing.Size(380, 138)
        Me.Result.TabIndex = 8
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.Location = New System.Drawing.Point(51, 242)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(71, 17)
        Me.Label5.TabIndex = 9
        Me.Label5.Text = "Subtotals:"
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.Location = New System.Drawing.Point(295, 432)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(44, 17)
        Me.Label6.TabIndex = 10
        Me.Label6.Text = "Total:"
        '
        'Totalprice
        '
        Me.Totalprice.Location = New System.Drawing.Point(357, 432)
        Me.Totalprice.Name = "Totalprice"
        Me.Totalprice.ReadOnly = True
        Me.Totalprice.Size = New System.Drawing.Size(73, 22)
        Me.Totalprice.TabIndex = 11
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(499, 486)
        Me.Controls.Add(Me.Totalprice)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Result)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Price)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TypeCustomer)
        Me.Controls.Add(Me.AddBook)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Book)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Book As System.Windows.Forms.ListBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents AddBook As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TypeCustomer As System.Windows.Forms.ListBox
    Friend WithEvents Price As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Result As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Totalprice As System.Windows.Forms.TextBox

End Class