Find the total cost, Visual Basic Programming

Assignment Help:

<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>


Related Discussions:- Find the total cost

Graphics device interface - windows programming , Graphics Device Interface...

Graphics Device Interface - GDI:   The GDI is a windows API. The GDI uses a set of generic graphics objects to draw to the screen, to the memory and printers. Therefore the p

How to include list box control in visual basic project, How to Include Lis...

How to Include List Box control in your project A list box is used for representing the users with a data. You can prefer the data from the list box for data entry. No editing

Scope and lifetime of variables, The scope of a variable is finding out by ...

The scope of a variable is finding out by where you declare it. While you declare a variable in a procedure, only code in that procedure can access or alter the value of that varia

Calculating annual percent yield, I am having a hard time with calculating ...

I am having a hard time with calculating APY in my project. Every time I run the program my second APY is blank.

Develop a university database using ms-access, Question 1 Write about the ...

Question 1 Write about the Visual Basic Application Development Life cycle with a sample Forms development for performing integer arithmetic operations Question 2 Discuss the

C#, i want to print number following pattern 1 12 123 1234

i want to print number following pattern 1 12 123 1234

Variable length strings, Variable Length Strings: The Strings can be de...

Variable Length Strings: The Strings can be declared using As or $ as shown in the code below; the msg and msg1 are the two strings and they are assigned the values using '='.

Menus and tool bars in visual basic, MENUS AND TOOL BARS   The Menu op...

MENUS AND TOOL BARS   The Menu options can be checked, enabled, disabled, and popped up on an object. The Menu Object: The Menu control is used to generate a menu in

For loop visual basic program, Write Visual Basic programs for the followin...

Write Visual Basic programs for the following: 1.     Write a program that uses a "For Loop" to generate a list of temperature conversions in one degree increments from a given

Messages - visual basic programming, MESSAGES The Windows-based applica...

MESSAGES The Windows-based applications do not make explicit function calls to acquire input. They wait for the system to pass the input to them. The system passes input to the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd