using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyMeths
{
[System.Runtime.InteropServices.ComVisible(true)]
public class WeightConversion
{
public double
kgsToStonesAndLbs(double kgs)
{
double onlyLbs = kgs *
2.2;
return onlyLbs;
}
public string
kgsToStonesAndLbs(double kgs, bool lbs)
{
double kg2st =
0.157473044;
string stonesAndLbs = Convert.ToString(Math.Truncate(kgs * kg2st)) + " st." + Math.Round((kgs
* kg2st - Math.Truncate(kgs
* kg2st)) * 14) + " lbs.";
return stonesAndLbs;
}
}
}
Edit: I've also tried public partial class WeightConversion combined with public static string kgsToStonesAndLbs(double kgs, bool lbs) but with no apparent success. And I forgot to mention I'm using VS2008 on 3.5 .NET.
Replies
Know the answer? Post it — somebody with the same question will find it here.