Im having trouble working out making a converter for mutliple currencys using multiple subs. I keep receiving an error saying that number is a friend , and therefore cannot be u
Not a direct answer, but this requires more space than would work in a comment.
You have a fundamental design error in your code. You really want to structure it more like this:
Function CANtoUSD(Number As Decimal) As Decimal
Dim USDConversion as Decimal = 1.0141
Return USDConversion * Number
End Function
Function CANtoJAP(Number As Decimal) As Decimal
Dim JAPConversion as Decimal = 79.9392
Return JAPConversion * Number
End Function
Sub Main()
Console.Writeline("Enter the CAN amount: ")
Dim input As Decimal = Console.ReadLine()
Console.WriteLine(CANtoUSD(input))
Console.WriteLine(CANtoJAP(input))
End Sub
You don't want to mix responsibilities for you methods. The input/output should be strictly separated from the code that manipulates the data. If nothing else, this makes it easier to test that your specific conversion methods work exactly like they are supposed to, and could not be the source of your bug.
Later on, you'll learn how to also ahave a single method that accepts a key value for both source and destination types, and does a table lookup to convert any currency to any other by knowing the conversion factor to a common currency.