424,963 Members | 1,046 Online
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

# Sales Tax Calculation

 P: 4 Hello! I am in a beginners computer class and I have a programming question that I need help with......PLEASE 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.WriteLine("Enter order in dollars: ") decOrder = Console.ReadLine() ' Calculate the sales tax decTax = 0.06 * (decOrder) decTotal = (decOrder + decTax) ' Write the results to the Console Window Console.WriteLine() Console.WriteLine("The Total is " & decTotal) Console.WriteLine("Press any key to continue.") End Module May 6 '07 #1
6 Replies

 Expert 100+ P: 2,364 Hello! I am in a beginners computer class and I have a programming question that I need help with......PLEASE 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       Sub Main()           Dim decOrder As Decimal         Dim decTax As Decimal           ' Accept the order from the Console window         Console.WriteLine("Enter order in dollars: ")         decOrder = Console.ReadLine()           ' Calculate the sales tax         decTax = 0.06 * (decOrder)           decTotal = (decOrder + decTax)           ' Write the results to the Console Window         Console.WriteLine()         Console.WriteLine("The Total is " & decTotal)         Console.WriteLine("Press any key to continue.")     End Module Expand|Select|Wrap|Line Numbers     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

 P: 4 [/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

 P: 4 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

 P: 29 Hi I'm new to this as well. Have you tried adding... Dim decTotal as Decimal Hope this helps May 7 '07 #5

 Expert 100+ P: 2,364 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

 P: 4 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.WriteLine("Enter order in dollars: ") decOrder = Console.ReadLine() ' Calculate the sales tax decTax = 0.06 * (decOrder + decTax) decTotal = (decOrder + decTax) ' Write the results to the Console Window Console.WriteLine() Console.WriteLine("The Total is " & decTotal) Console.WriteLine("Press any key to continue.") End Sub End Module May 8 '07 #7