5. “OptionB” Method
Create a method called “OptionB” that will print the conversion from miles to kilometres by calling “MilesToKilometers” method (defined in the item #6 below) starting at 10 miles up to 100 miles in increments of 10. Show the result on a table in the console.
6. “MilesToKilometers” Method
Create a method called “MilesToKilometers”
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputeAverageApp
{
class ComputeAverageProgram
{
static void Main(string[] args)
{
OptionB();
Console.ReadKey();
}
private static void OptionB()
{
Console.WriteLine("miles kilometers");
for (int mile = 10; mile <= 100; mile += 10)
{
double km = 0;
MilesToKilometers(mile, out km);
Console.WriteLine("{0, 4} {1}", mile, km);
}
}
private static void MilesToKilometers(double mlValue, out double kmValue)
{
kmValue = mlValue * 1.60934;
}
}
}
Comments
Leave a comment