Question: I am supposed to modify the code below so that it goes from Kilometers to miles and feet. The code is written in c# and
I am supposed to modify the code below so that it goes from Kilometers to miles and feet. The code is written in c# and I am supposed to change it as little as possible.
/* DistanceConverterApp.cs * This application converts miles into * feet and kilometers. * It provides practice designing a * solution requiring research for the formulas. */
using System; using static System.Console;
namespace DistanceConverterApp { class DistanceConverterApp { static void Main() { const int FEET_PER_MILE = 5280; const double MILES_TO_KILOMETER_CONVERSION_FACTOR = 1.6;
double miles = 4.5; double feet, kilometer;
feet = FEET_PER_MILE * miles; kilometer = miles * MILES_TO_KILOMETER_CONVERSION_FACTOR;
WriteLine("\tDistance Converter App "); WriteLine("Miles: {0,12:N2}", miles); WriteLine(" \tEquivalent Values"); WriteLine("Feet: {0,10:N0}", feet); WriteLine("Kilometers: {0,8:N2}", kilometer); ReadKey(); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
