3.“OptionA” Method
Create a method called “OptionA” that will print the conversion from pounds to kilograms by calling “PoundsToKilograms” method (defined in the item #4 below) starting at 200 pounds down to 50 pounds in decrements of 5. Show the result on a table in the console.
4. “PoundsToKilograms” Method
Create a method called “PoundsToKilograms”
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace C_SHARP
{
class Program
{
static double PoundsToKilograms(double pounds)
{
return pounds * 0.454;
}
static void OptionA()
{
for (int i = 200; i >= 50; i -= 5) {
Console.WriteLine(i.ToString() + " pounds = " + PoundsToKilograms(i).ToString() + " Kilograms");
}
}
static void Main(string[] args)
{
OptionA();
Console.ReadKey();
}
}
}
Comments
Leave a comment