473,568 Members | 3,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sales Tax Calculation

4 New Member
Hello! I am in a beginners computer class and I have a programming question that I need help with......PLEAS E HELP!!!!!!

I have to write the following in Visual Basic.Net

Marie's Flower Shop would like to provide its front counter employees with a program that calculates the sales tax. The application should let the employee enter the amount of the customer's order and then calculate a 6% sales tax. After the employee enters the order amount and presses the enter key, the program should display the amount of the customer's order and the tax, followed by the total of the customer's order and tax added together. For example, an order amount of $100 should result in a tax of $6 and a total of $106.... This is what I have done but its not working!!! Can anyone try to figure out what I am doing wrong?

Sub Main()

Dim decOrder As Decimal
Dim decTax As Decimal

' Accept the order from the Console window
Console.WriteLi ne("Enter order in dollars: ")
decOrder = Console.ReadLin e()

' Calculate the sales tax
decTax = 0.06 * (decOrder)

decTotal = (decOrder + decTax)

' Write the results to the Console Window
Console.WriteLi ne()
Console.WriteLi ne("The Total is " & decTotal)
Console.WriteLi ne("Press any key to continue.")


End Module
May 6 '07 #1
6 7372
Dököll
2,364 Recognized Expert Top Contributor
Hello! I am in a beginners computer class and I have a programming question that I need help with......PLEAS E HELP!!!!!!

I have to write the following in Visual Basic.Net

Marie's Flower Shop would like to provide its front counter employees with a program that calculates the sales tax. The application should let the employee enter the amount of the customer's order and then calculate a 6% sales tax. After the employee enters the order amount and presses the enter key, the program should display the amount of the customer's order and the tax, followed by the total of the customer's order and tax added together. For example, an order amount of $100 should result in a tax of $6 and a total of $106.... This is what I have done but its not working!!! Can anyone try to figure out what I am doing wrong?

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Sub Main()
  3.  
  4.         Dim decOrder As Decimal
  5.         Dim decTax As Decimal
  6.  
  7.         ' Accept the order from the Console window
  8.         Console.WriteLine("Enter order in dollars: ")
  9.         decOrder = Console.ReadLine()
  10.  
  11.         ' Calculate the sales tax
  12.         decTax = 0.06 * (decOrder)
  13.  
  14.         decTotal = (decOrder + decTax)
  15.  
  16.         ' Write the results to the Console Window
  17.         Console.WriteLine()
  18.         Console.WriteLine("The Total is " & decTotal)
  19.         Console.WriteLine("Press any key to continue.")
  20.  
  21.  
  22. End Module
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
Greetings, pinkstarr19!

Can you tell us a little more? You mentioned it is not working, but are you getting errors.

I added code tags on your behalf to allow a cleaner reading of your information.

Please stay tuned.

By the way, is using F8 via Debug mode available in .Net. Works with 6.0. If so, this might give you an idea where the code is not working.

Dököll
May 6 '07 #2
pinkstarr19
4 New Member
[/code]Greetings, pinkstarr19!

Can you tell us a little more? You mentioned it is not working, but are you getting errors.

I added code tags on your behalf to allow a cleaner reading of your information.

Please stay tuned.

By the way, is using F8 via Debug mode available in .Net. Works with 6.0. If so, this might give you an idea where the code is not working.

Dököll


Greetings DoKoll

Thank you so much for trying to help me. I have worked on this problem for 6 hours today and cannot figure it out. The errors that I am getting are :
"Name 'decTotal' is not declared for Line 21 and 25"

I used the F8 key like you said, and that is what came up.

I really appreciate you trying to help me here. Programming is a little foreign to me....
May 7 '07 #3
pinkstarr19
4 New Member
Greetings DoKoll

Thank you so much for trying to help me. I have worked on this problem for 6 hours today and cannot figure it out. The errors that I am getting are :
"Name 'decTotal' is not declared for Line 21 and 25"

I used the F8 key like you said, and that is what came up.

I really appreciate you trying to help me here. Programming is a little foreign to me....
May 7 '07 #4
Lazareth
29 New Member
Hi I'm new to this as well. Have you tried adding...

Dim decTotal as Decimal

Hope this helps
May 7 '07 #5
Dököll
2,364 Recognized Expert Top Contributor
Hi I'm new to this as well. Have you tried adding...

Dim decTotal as Decimal

Hope this helps
Good job, Lazareth, I think that'll do it...

And you're quite welcome, pinkstarr19, be patient, a light will come on and you will nail this one down:-)
May 8 '07 #6
pinkstarr19
4 New Member
This is what it looks like now after I made changes and it is still not working. I added the Dim decTotal As Decimal and it fixed the error. However, the calculator comes up but when I put the calculator amount of 100.00 and press enter, it automatically exits out of the calculator. Also, the cusor isn't at the top line where it says enter order in dollars. Thank you for checking on this...

Sub Main()

Dim decOrder As Decimal
Dim decTax As Decimal
Dim decTotal As Decimal

' Accept the order from the Console window
Console.WriteLi ne("Enter order in dollars: ")
decOrder = Console.ReadLin e()

' Calculate the sales tax
decTax = 0.06 * (decOrder + decTax)

decTotal = (decOrder + decTax)

' Write the results to the Console Window
Console.WriteLi ne()
Console.WriteLi ne("The Total is " & decTotal)
Console.WriteLi ne("Press any key to continue.")
End Sub

End Module
May 8 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4048
by: Terencetrent | last post by:
I have created a query that examines qarterly sales for 5 regions in the country. The query contains data for the past 6 quarters for each region and calculates the perecentage of total sales for the quarter fo each region. To help enhance the report I would love to include a comparison to of current sales to previous quarter sales and a...
6
2909
by: Gary | last post by:
I have an example table with fields and records as shown below: RECORD_ID DATE PRODUCT QUANTITY 1 4/1/05 widget1 50 2 4/2/05 widget1 48 3 4/3/05 widget1 42 4 4/4/05 widget1 28 5 4/5/05 widget1 13 6 4/6/05 widget1 5 .. ...
5
39232
by: steve | last post by:
Hi All Not sure if this is the right forum, but I need the formula for calculating the amount of Sales tax (GST) from the tax included price In Australia GST is 10% and the standard formula is to divide the total by 11 to get the gst amount This is great until the GST % changes one day
1
1328
by: Mohammad Nowfal | last post by:
I am working on a Sales Data page of a Rent a car database where I encounter the below problem: I have the below fields in a FORM (called Sales ) namely: 1. Odometer_Start 2. Odometer_End 3. Kilometer_Driven 4. Extra_Kilometer 5. Total_Days 6. Extra_Kilometer_Charge
15
6158
klarae99
by: klarae99 | last post by:
I am working on an Inventory Database in Access 2003. I am working on a report that I could print when its time to file our State Sales Tax paperwork. The figures I need for this report are Total Sales(not including tax), the Amount of Sales Subject to Tax, and the Total Sales Including Tax, all gathered for a specific time period. I have a...
5
3216
by: mbatestblrock | last post by:
Hey all! Happy new years! I was having some difficulty trying to get this one figured out and I was hoping I could get some pointers on the board. Here is my form: http://www.mykesdesigns.com/jwservices.jpg Pretty basic... In the bottom left, starting with "Subtotal" it is getting its total from "Service Charge" , "Mileage Charge"...
2
4020
by: mauking | last post by:
Hello Everyone, Im a certified public accountant here in the Philippines. Im using microsoft access 2000 and 2003 running in a Windows XP environment. Im having a problem of how to calculate a running balance using a query coming from two tables. This is my problem. I have two tables (Sales and Collections), with these table I wanted to...
12
4914
by: spima05 | last post by:
Hello I am developing a database to calculate commissions on a sale for each rep involved in the same and their uplines. Below is the database structure and the commissions schedule. I am having trouble designing a way to store the commission rates and calculate the commission amounts. Below is a list of the business rules for...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.