configuring function

configuring function

Page 1 of 1

2 Replies - 1122 Views - Last Post: 12 February 2008 - 11:31 PM Rate Topic: -----

#1 jrb47  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 21-April 07

configuring function

Posted 11 February 2008 - 10:34 PM

I am working on a programming assignment.
I have a few questions as the book is ambiguous to say the least.
PROJECT: create page that allows purchase of variable quantity of two items, totals and then figures tax. I have gotten as far as figuring the subtotal of the individual items. The problem I am having is getting started with the function for figuring the tax and then the total sale.

Here is the code

<script language="vb" runat="server">
  Sub Page_Load()
  Dim pinkfloydshirt As Decimal
  Dim wowhat As Decimal
  
  Dim subtotal As Decimal
  Dim subtotal2 As Decimal
  Dim subtotal3 As Decimal
  Dim totalsale AS Decimal
  
  Dim tax As decimal
  tax = Findtax(subtotal3)  
  
  pinkfloydshirt = 14.99
  wowhat = 8.99
  
  totalsale = subtotal3 + tax
	
  Message1.text = "Pink Floyd Tshirt Cost $" & pinkfloydshirt
  Message2.text = "Wow Hat Cost $" & wowhat
 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3
	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if
  
End Sub

 Function Findtax(subtotal3 as decimal) As Decimal
 Dim tax As decimal
 tax = subtotal3 * .08
 return tax
 End Function

</script>

<html>
<head>
<title>Sample Function Page</title>
</head>
<body>
  <h2>Thank  you for Shopping at Shirts and More.</h2>
  
	 <form runat="server">
	  <asp:label id="message1" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="shirtquantity" runat="server" /><br />
	  <asp:label id="message3" runat="server"/> <br/><br />
		 
	  <asp:label id="message2" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="hatquantity" runat="server" /><br />
	  <asp:label id="message4" runat="server"/> <br/><br />
	 
	  <asp:label id="message5" runat="server"/> <br/>
	  <asp:label id="message7" runat="server"/> <br/>
	  <asp:label id="message6" runat="server"/> <br/><br />

	  <input type="Submit">
	 </form>
 

  
  
</body>
</html>



Thanks for any help
Jess

This post has been edited by jrb47: 12 February 2008 - 01:03 AM


Is This A Good Question/Topic? 0
  • +

Replies To: configuring function

#2 dygytalnomad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 08

Re: configuring function

Posted 12 February 2008 - 03:18 PM

View Postjrb47, on 11 Feb, 2008 - 10:34 PM, said:

I am working on a programming assignment.
I have a few questions as the book is ambiguous to say the least.
PROJECT: create page that allows purchase of variable quantity of two items, totals and then figures tax. I have gotten as far as figuring the subtotal of the individual items. The problem I am having is getting started with the function for figuring the tax and then the total sale.

Here is the code

<script language="vb" runat="server">
  Sub Page_Load()
  Dim pinkfloydshirt As Decimal
  Dim wowhat As Decimal
  
  Dim subtotal As Decimal
  Dim subtotal2 As Decimal
  Dim subtotal3 As Decimal
  Dim totalsale AS Decimal
  
  Dim tax As decimal
  tax = Findtax(subtotal3)  
  
  pinkfloydshirt = 14.99
  wowhat = 8.99
  
  totalsale = subtotal3 + tax
	
  Message1.text = "Pink Floyd Tshirt Cost $" & pinkfloydshirt
  Message2.text = "Wow Hat Cost $" & wowhat
 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3
	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if
  
End Sub

 Function Findtax(subtotal3 as decimal) As Decimal
 Dim tax As decimal
 tax = subtotal3 * .08
 return tax
 End Function

</script>

<html>
<head>
<title>Sample Function Page</title>
</head>
<body>
  <h2>Thank  you for Shopping at Shirts and More.</h2>
  
	 <form runat="server">
	  <asp:label id="message1" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="shirtquantity" runat="server" /><br />
	  <asp:label id="message3" runat="server"/> <br/><br />
		 
	  <asp:label id="message2" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="hatquantity" runat="server" /><br />
	  <asp:label id="message4" runat="server"/> <br/><br />
	 
	  <asp:label id="message5" runat="server"/> <br/>
	  <asp:label id="message7" runat="server"/> <br/>
	  <asp:label id="message6" runat="server"/> <br/><br />

	  <input type="Submit">
	 </form>
 

  
  
</body>
</html>



Thanks for any help
Jess


You probably can't find the tax and subtotal or grand total before you find the subtotal
So this should be the last line of code before you find the grand total
tax = Findtax(subtotal3)

 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3

tax = FindTax(subtotal3)

	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if



You need to do the totalsales around the area where you figure out tax too.

HTH.
Was This Post Helpful? 0
  • +
  • -

#3 cprmnm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-December 07

Re: configuring function

Posted 12 February 2008 - 11:31 PM

View Postdygytalnomad, on 12 Feb, 2008 - 03:18 PM, said:

View Postjrb47, on 11 Feb, 2008 - 10:34 PM, said:

I am working on a programming assignment.
I have a few questions as the book is ambiguous to say the least.
PROJECT: create page that allows purchase of variable quantity of two items, totals and then figures tax. I have gotten as far as figuring the subtotal of the individual items. The problem I am having is getting started with the function for figuring the tax and then the total sale.

Here is the code

<script language="vb" runat="server">
  Sub Page_Load()
  Dim pinkfloydshirt As Decimal
  Dim wowhat As Decimal
  
  Dim subtotal As Decimal
  Dim subtotal2 As Decimal
  Dim subtotal3 As Decimal
  Dim totalsale AS Decimal
  
  Dim tax As decimal
  tax = Findtax(subtotal3)  
  
  pinkfloydshirt = 14.99
  wowhat = 8.99
  
  totalsale = subtotal3 + tax
	
  Message1.text = "Pink Floyd Tshirt Cost $" & pinkfloydshirt
  Message2.text = "Wow Hat Cost $" & wowhat
 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3
	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if
  
End Sub

 Function Findtax(subtotal3 as decimal) As Decimal
 Dim tax As decimal
 tax = subtotal3 * .08
 return tax
 End Function

</script>

<html>
<head>
<title>Sample Function Page</title>
</head>
<body>
  <h2>Thank  you for Shopping at Shirts and More.</h2>
  
	 <form runat="server">
	  <asp:label id="message1" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="shirtquantity" runat="server" /><br />
	  <asp:label id="message3" runat="server"/> <br/><br />
		 
	  <asp:label id="message2" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="hatquantity" runat="server" /><br />
	  <asp:label id="message4" runat="server"/> <br/><br />
	 
	  <asp:label id="message5" runat="server"/> <br/>
	  <asp:label id="message7" runat="server"/> <br/>
	  <asp:label id="message6" runat="server"/> <br/><br />

	  <input type="Submit">
	 </form>
 

  
  
</body>
</html>



Thanks for any help
Jess


You probably can't find the tax and subtotal or grand total before you find the subtotal
So this should be the last line of code before you find the grand total
tax = Findtax(subtotal3)

 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3

tax = FindTax(subtotal3)

	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if



You need to do the totalsales around the area where you figure out tax too.

HTH.



hI friends can u help me to create a forum in asp.net



View Postjrb47, on 11 Feb, 2008 - 10:34 PM, said:

I am working on a programming assignment.
I have a few questions as the book is ambiguous to say the least.
PROJECT: create page that allows purchase of variable quantity of two items, totals and then figures tax. I have gotten as far as figuring the subtotal of the individual items. The problem I am having is getting started with the function for figuring the tax and then the total sale.

Here is the code

<script language="vb" runat="server">
  Sub Page_Load()
  Dim pinkfloydshirt As Decimal
  Dim wowhat As Decimal
  
  Dim subtotal As Decimal
  Dim subtotal2 As Decimal
  Dim subtotal3 As Decimal
  Dim totalsale AS Decimal
  
  Dim tax As decimal
  tax = Findtax(subtotal3)  
  
  pinkfloydshirt = 14.99
  wowhat = 8.99
  
  totalsale = subtotal3 + tax
	
  Message1.text = "Pink Floyd Tshirt Cost $" & pinkfloydshirt
  Message2.text = "Wow Hat Cost $" & wowhat
 
if shirtquantity.Text <> "" then
	subtotal = shirtquantity.text * pinkfloydshirt
 	Message3.text = subtotal
	subtotal3 = subtotal
end if

if hatquantity.Text <> "" then
	subtotal2 = hatquantity.text * wowhat
	Message4.text = subtotal2
	subtotal3 = subtotal3 + subtotal2
	Message5.text = "your subtotal for order is $" & subtotal3
	Message7.text = "sales tax is $" & tax
	Message6.text = "Total order is $" & totalsale
end if
  
End Sub

 Function Findtax(subtotal3 as decimal) As Decimal
 Dim tax As decimal
 tax = subtotal3 * .08
 return tax
 End Function

</script>

<html>
<head>
<title>Sample Function Page</title>
</head>
<body>
  <h2>Thank  you for Shopping at Shirts and More.</h2>
  
	 <form runat="server">
	  <asp:label id="message1" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="shirtquantity" runat="server" /><br />
	  <asp:label id="message3" runat="server"/> <br/><br />
		 
	  <asp:label id="message2" runat="server"/> <br/>
	  Quantity ordered
	  <asp:textbox id="hatquantity" runat="server" /><br />
	  <asp:label id="message4" runat="server"/> <br/><br />
	 
	  <asp:label id="message5" runat="server"/> <br/>
	  <asp:label id="message7" runat="server"/> <br/>
	  <asp:label id="message6" runat="server"/> <br/><br />

	  <input type="Submit">
	 </form>
 

  
  
</body>
</html>



Thanks for any help
Jess

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1