Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Visual Basic Expert

<HTML>

<H2> Case: Design a web page that contains the VBScript utilized for calculating subtotals, taxes, discounts & totals as well as code utilized to validate user input.</H2>

<HEAD>

<TITLE>VBScript: Case Study</TITLE>

<SCRIPT LANGUAGE="VBScript">

<!-- Add this to instruct non-IE browsers to skip over VBScript modules. Option Explicit

Sub cmd Calculate_On Click Dim Amount of Discount Dim Amount of Tax

Dim DISCOUNT_LIMIT Dim DISCOUNT_RATE Dim Subtotal Before

Dim Subtotal After Dim TAX_RATE Dim Total Cost

 

If (Len(Document .frmCaseStudy.txtQuantity.Value) = 0) Then

MsgBox "You have to enter quantity." Exit Sub

End If

If (Not IsNumeric(Document.frmCaseStudy.txtQuantity.Value)) Then

MsgBox "Quantity has to be a numeric value." Exit Sub

End If

If (Len(Document.frmCaseStudy.cmbProducts.Value) = 0) Then

MsgBox "You have to select product." Exit Sub

End If

DISCOUNT_LIMIT = 1000

DISCOUNT_RATE = .10

TAX_RATE = 0.06

'Calculate the subtotal for the order.

SubtotalBefore=Document.frmCaseStudy.txtQuantity.Value* Document.frmCaseStudy.lblUnitCost.value

If (SubtotalBefore > DISCOUNT_LIMIT) Then

AmountofDiscount = SubtotalBefore * DISCOUNT_RATE Else

AmountofDiscount = 0

End If

SubtotalAfter = SubtotalBefore - AmountofDiscount

' Calculate taxes & total cost.

AmountofTax = SubtotalAfter * TAX_RATE TotalCost = SubtotalAfter + AmountofTax

'Display the results. Document.frmCaseStudy.lblSubtotalBefore.value = SubtotalBefore Document.frmCaseStudy.lblDiscount.value=AmountofDiscount Document.frmCaseStudy.lblSubtotalAfter.value=SubtotalAfter Document.frmCaseStudy.lblTaxes.value=AmountofTax Document.frmCaseStudy.lblTotalCost.value = TotalCost

 

End Sub

Sub cmdSubmit_onClick

'Submit this order for processing.

MsgBox "Your order has been submitted." Document.frmCaseStudy.Submit

End Sub

Sub cmbProducts_onchange()

Select Case Document.frmCaseStudy.cmbProducts.SelectedIndex

Case 1

Document.frmCaseStudy.lblUnitCost.value = 1590

Case 2

Document.frmCaseStudy.lblUnitCost.value = 880

Case 3

Document.frmCaseStudy.lblUnitCost.value = 1940

Case Else

Document.frmCaseStudy.lblUnitCost.value = 0

End Select

End Sub

-->

</SCRIPT>

</HEAD>

<BODY>

<FORM NAME="frmCaseStudy">

<TABLE>

<TR>

<TD><B>Monitor:</B></TD>

<TD>

<SELECT NAME = "cmbProducts">

<OPTION VALUE ="0" ></OPTION>

<OPTION VALUE ="1" >Item 1</OPTION>

<OPTION VALUE ="2">Item 2</OPTION>

<OPTION VALUE ="3">Item 3</OPTION>

</SELECT>

</TD>

</TR>

<TR>

<TD><B>Quantity:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="txtQuantity" >

</TD>

</TR>

<TR>

<TD><INPUT TYPE="Button" NAME="cmdCalculate" VALUE="Calculate

Cost"></TD>

<TD></TD>

</TR>

<TR>

<TD><B>Unit Cost:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="lblUnitCost" >

</TD>

</TR>

<TR>

<TD><B>Subtotal before discount:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="lblSubtotalBefore" >

</TD>

</TR>

<TR>

<TD><B>Discount:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME = "lblDiscount" >

</TD>

</TR>

<TR>

<TD><B>Subtotal after discount:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="lblSubtotalAfter" >

</TD>

</TR>

<TR>

<TD><B>Taxes:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="lblTaxes" >

</TD>

</TR>

<TR>

<TD><B>Total Cost:</B></TD>

<TD>

<INPUT TYPE = "TEXT" NAME ="lblTotalCost" >

</TD>

</TR>

<TR>

<TD><INPUT TYPE="Button" NAME="cmdSubmit" VALUE="Submit

Order"></TD>

<TD></TD>

</TR>

</TABLE>

</FORM>

</BODY>

</HTML>

Visual Basic, Programming

  • Category:- Visual Basic
  • Reference No.:- M9622198

Have any Question?


Related Questions in Visual Basic

Assignment virtual storeuse the concepts and scenario from

Assignment: Virtual Store Use the concepts and scenario from Assignment 1 to help "Your" Virtual Business to increase the functionality of its online shopping cart. When a customer checks out, the shopping cart must stor ...

Assignment frans virtual fruit standfrans virtual fruit

Assignment: Fran's Virtual Fruit Stand Fran's Virtual Fruit Stand is an online store that sells several types of dried fruit. Based on the needs of Fran's Virtual Fruit stand, you must design a flowchart using Visual Log ...

Please show how to do the belowvisual basic net application

Please show how to do the below: Visual Basic .NET Application - Coding Exercise 1 (Exercise 13, Zak, 2016, p. 347) For this coding exercise, write the Visual Basic code for a pretest loop that uses an Integer variable n ...

Pitch amp game design documentthe assignment is about

Pitch & Game Design Document The assignment is about educational driver for teenagers Assignment Brief: In groups you will: - present a pitch and produce a one sheet - provide a demonstration of your game - produce a hig ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As