Answer to Question #296874 in C# for chi

Question #296874

Topic: Function

Write a function-­‐oriented program to convert the input dollar(s) into its equivalent

peso. Assume that one dollar is equivalent to 53.80 pesos.

Note: you can choose any looping statement if needed.


1
Expert's answer
2022-02-14T15:04:43-0500
using System;

namespace convert
{
    class Program
    {
        public static double Exchange(double dollar)
        {
            double rate = 53.80;
            return (dollar * rate);
        }
        
        public static void Main(string[] args)
        {
            double exch;
            Console.Write("Enter dollar(s): ");
            exch = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Equivalent peso: {0}", Exchange(exch));
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS