'Radio Choice Selection
Console.WriteLine("Please enter the Radio Choice for your vehicle: ")
Console.WriteLine("Enter 1 for AM/FM Radio")
Console.WriteLine("Enter 2 for AM/FM/CD/DVD")
strRadioChoice = Console.ReadLine()
Select Case strRadioChoice
Case "1"
Console.WriteLine("Price : $100")
Case "2"
Console.WriteLine("Price : $400")
Case Else
Console.WriteLine("Invalid selection")
End Select
SellingPrice = BasePrice + strEngineChoice + strInteriorChoice + strRadioChoice + ShippingCharge + DealerCharge
Console.WriteLine("The total selling price for your vehicle is $" + SellingPrice)
Console.WriteLine()
Console.WriteLine("Press Enter to Exit")
Console.ReadLine()
JRabbit2307 0 Light Poster
Recommended Answers
Jump to PostYou need to be storing these individual values into numeric variables to be calculated at the end.
'Radio Choice Selection Dim decRadioPrice As Decimal Console.WriteLine("Please enter the Radio Choice for your vehicle: ") Console.WriteLine("Enter 1 for AM/FM Radio") Console.WriteLine("Enter 2 for AM/FM/CD/DVD") strRadioChoice = Console.ReadLine() Select Case …
Jump to PostYou should use
integer.TryParse()
ordecimal.TryParse()
instead of handling the exception. Throwing exceptions is a very expensive process and if you have exceptions being thrown in calculations (where it can occur over and over in loops) it can bring a system to a halt depending on the amount of data.
Jump to PostCast with the "CInt" function
All 9 Replies
TomW 73 Posting Whiz
JRabbit2307 commented: thanks this solved it! +1
mikiurban 16 Junior Poster in Training
JRabbit2307 commented: thank you for your help! +1
sknake 1,622 Senior Poster Featured Poster
JRabbit2307 commented: thank you +1
mikiurban 16 Junior Poster in Training
JRabbit2307 0 Light Poster
JRabbit2307 0 Light Poster
jbennet 1,618 Most Valuable Poster Team Colleague Featured Poster
JRabbit2307 commented: thank you +1
JRabbit2307 0 Light Poster
jbennet 1,618 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.