Does this look right> VB2010

Status
Not open for further replies.

Slacker

Slacking Guru
Messages
316
Location
placetoplace
'Declarations
Dim decCelsius As Decimal = 0
Dim decFahrenheit As Decimal = 0


'Input Console Window
Console.Write("Please enter a Celsius Temperature.")
decCelsius = CDec(Console.ReadLine())


'Process Calculate Celsius
decFahrenheit = CDec(decCelsius * 1.8 + 32)

'Output to Console Window
Console.WriteLine()
Console.WriteLine("Fahrenheit Temperature " & decFahrenheit)


'Termination: Hold Program on Console Screen
Console.WriteLine()
Console.Write("Press the Enter key to terminate program.")
Console.Read()
 
not saying anything is wrong... but then again I wouldn't know if it was.

just wondering...

It looks like I may have added an xtra Console.Writes in there...Now trying to figure out how to call......
 
6: pseudocode - you did not include the tax rates. Your set statements do not assign the result of the calculations to your variables. You do not calculate or display the total tax. -20 Raptor - similar problems and you do not include any variables in the output. -20 vb - I don't know how you got so close to correct when your plans were completely wrong. You did not put the output in the correct order and you forgot to calculate and display the total tax. -10
9: pseudocode - you do not get the celsius temp after prompting. -10 Raptor - you assign the result of your calculation to process instead of fahrenheit so the answer will always be 0 and you do not have a prompt for the input. -20 Strange again that your vb is correct, because you did not show a concept in planning. This course is not about vb, it is about planning. We only do vb so that you know why you are planning. Perhaps you can enlighten me on what is happening here.




this was the feedback........ am I wrong or does he state for the most part I was correct on the VB side... just looked like I did not plan it out?
just in case anybody wants to the VB for tax
'Declarations
Dim decPurchase As Decimal
Dim decCountyTax As Decimal
Dim decStateTax As Decimal
Dim decTotal As Decimal

'Input from Console window
Console.WriteLine("Please enter purchase amount in dollars $")
decPurchase = CDec(Console.ReadLine())

'Process: Calculate the County Tax
decCountyTax = CDec(0.02 * decPurchase)

'Process: Calculate the Sale Tax
decStateTax = CDec(decPurchase * 0.04)

'Process: Calculate the Purchase * Tax
decTotal = CDec(decPurchase + decStateTax + decCountyTax)

' Write the results to the Console Window
Console.WriteLine("County Tax Paid $" & decCountyTax)

' Write the results to the Console Window
Console.WriteLine("State Tax Paid $" & decStateTax)

' Write the results to the Console Window
Console.WriteLine("Original Purchase Price $" & decPurchase)

' Write the results to the Console Window
Console.WriteLine("Original Purchase Price with tax $" & decTotal)

'Termination: Hold Program on Console Screen
Console.Write("Press the Enter key to terminate program.")
Console.Read()
 
I will be posting this weeks assignments tomorrow after I submit them(can post syllabus if any concerns.) . I will also post the feedback I get. I want to be clear I am not looking for help doing my homework. I can screw that up myself.
 
Well reiterating what the prof said, the main purpose is to understand how to code, not how to code in VB. VB is pretty easy, especially when you use Visual Studio. Make sure you post your psudeocode as well as that's where the problems seem to crop up, cause your code seems fine and if your results check out then that's fine and dandy. He seems kinda harsh though... saying your code is completely wrong and then seems surprised when your numbers are sorta right.

the only thing I can think with the tax rates is that he would want them defined as well. Like Dim decStateTaxRate As Decimal = .02
 
One small nit is that you prompt user for celcius temp then your comment says "Process Calculate Celsius". It really should say "Process Calculate Fahrenheit" since that's what is being calculated. That could be a source of confusion for someone reading your code.
 
Thanks everybody for the response! I have been busy well... being a slacker..

but soon I will return to pust my masterpiece.. and I'm not talking about bbq sauce....
 
Status
Not open for further replies.
Back
Top Bottom