Q:

Convert the InchesToCentimeters program to an interactive application named InchesToCentimeterslnteractive. Instead of assigning a value to the inches variable, accept the value from the user as input

0

Convert the InchesToCentimeters program to an interactive application named InchesToCentimeterslnteractive. Instead of assigning a value to the inches variable, accept the value from the user as input.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace InchesToCentmeters
{
    class InchesToCentimeterslnteractive
    {
        static void Main(string[] args)
        {
            WriteLine("InchesToCentimeters");

            const double CM_PER_IN = 2.54;
            double inputInches = 0;
            double convertedCentimeters = 0;

            //skip error checking
            Write("Input inches:");

            inputInches = double.Parse(ReadLine());
            convertedCentimeters = inputInches * CM_PER_IN;

            WriteLine("{0} inches is {1} centimeters.", inputInches, convertedCentimeters);

            WriteLine("--End--");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now