Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8700991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:17:36+00:00 2026-06-13T02:17:36+00:00

Im having trouble working out making a converter for mutliple currencys using multiple subs.

  • 0

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 used in the jap conversion . can anyone help ? thank you in advance

Option Explicit On
'Option Strict On

Imports System

Module Yahtzed

    Sub CANtoUSD()
        Dim Number , USDConversion as Decimal
        Number = Console.Readline
        USDConversion =( Number * 1.0141)
        Console.Writeline(USDConversion)
    End Sub

    Sub CANtoJAP()
        Dim Number, JAPConversion as Decimal
        Number = Console.Readline
        JAPConversion =( Number * 79.9392)
        Console.Writeline(JAPConversion)
    End Sub

    Sub Main()
        Console.Writeline("Enter the CAN amount: ")
        CANtoUSD()
        CANtoJAP()

    End Sub

End Module
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:17:37+00:00Added an answer on June 13, 2026 at 2:17 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble working out how to pass in arguments into transactions when using
I'm having trouble working out how to insert multiple-depths of nested schema in MongoDB,
I am having trouble working out how to get a simple fade in fade
I'm having trouble working out the best way to repaint a JxTreeTable when the
I'm currently battling through some memory leaks and having some serious trouble working out
I'm having trouble getting Tire working using ElasticSearch with the Bonsai addon on the
I'm having trouble with getting a named scope working using using an attribute of
I'm having trouble working out the syntax for doing a replacement search with regular
i'm having trouble working out the returned values of the below code pMeasure =
I'm having trouble working out why the following code doesn't catch the exception. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.