Answer to Question #187130 in C# for angelo r reyes

Question #187130

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.


1
Expert's answer
2021-05-01T14:11:04-0400
using System;

namespace Test
{
    class ExchangeTest
    {
        static void Main()
        {
            Console.Write("Enter the value in dollars: ");
            string tmp = Console.ReadLine();

            float dollars;
            if(!float.TryParse(tmp, out dollars))
            {
                Console.WriteLine("Bad input");
            }
            else 
            {
                Console.WriteLine("The value in pesos: {0:0.00}", dollars * 53.80);
            }
        }
    }
}

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
APPROVED BY CLIENTS