Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please look at this VB sho Public Class frmShoppingCart 'Sales tax on total cost Public Const decSALES_TAX As Decimal = 0.06D 'Shipping Cost

Can someone please look at this VB shoimage text in transcribedPublic Class frmShoppingCart 'Sales tax on total cost Public Const decSALES_TAX As Decimal = 0.06D 'Shipping Cost on each item Public Const decSHIPPING_CHARGE As Decimal = 2 Public printBookPrice() As Decimal = {11.95D, 14.5D, 29.95D, 18.5D} Public printBookName() As String = {"I Did It your Way", "The History of Scotland", "Learn Calculus in One Day", "Feel the Stress"} Public audioBookPrice() As Decimal = {29.95D, 14.5D, 12.95D, 11.5D} Public audioBookName() As String = {"Learn Calculus in One Day", "The History of Scotland", "The Science of Body Language", "Relaxation Techniques"} Private Sub mnuReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuReset.Click 'Reset the form. lblSubtotal.Text = String.Empty lblTax.Text = String.Empty lblShipping.Text = String.Empty lblTotal.Text = String.Empty lstProducts.Items.Clear() End Sub Private Sub mnuPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPrint.Click frmPrintbooks.Show() End Sub Private Sub mnuAudio_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAudio.Click frmAudiobooks.Show() End Sub Public Sub DisplayCharges() 'This procedure calculates the tax, shipping charge and total cart purchase. Dim BookTotal As Decimal = 0 For Each Book As String In lstProducts.Items If Book.StartsWith("A") Then BookTotal += audioBookPrice(CInt(Book.Substring(1, 1))) Else ' must be a print book BookTotal += printBookPrice(CInt(Book.Substring(1, 1))) End If Next Dim BookCount As Integer = lstProducts.Items.Count 'Display the Data. lblSubtotal.Text = BookTotal.ToString("c") lblTax.Text = (BookTotal * decSALES_TAX).ToString("c") BookTotal += BookTotal * decSALES_TAX lblShipping.Text = (BookCount * decSHIPPING_CHARGE).ToString("c") BookTotal += BookCount * decSHIPPING_CHARGE lblTotal.Text = BookTotal.ToString("c") End Sub Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click 'End the application Me.Close() End Sub Private Sub mnuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAbout.Click 'Displays an about box. MessageBox.Show("The Shopping Cart System allows customers to shop for both Print and Audio Books.", "Shopping Cart About") End Sub Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click 'Remove Items from List Box If lstProducts.SelectedIndex -1 Then lstProducts.Items.RemoveAt(lstProducts.SelectedIndex) End If DisplayCharges() End Sub End Classpping cart assignment. There is a error that is keeping the project from working.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions