-2

I have created an application in WPF which convert Imperial to Metric and Metric to Imperial units. I have data in Inch unit now this value i want to convert it in Fraction unit. I have searched but not got any specific formula to implement.

Any idea?

1) Eg: 39.75 Output:100921⁄32mm

Note: Input value is in inch i.e 39.75 inch and out put is in fraction unit.

See Conversion Chart

SHEKHAR SHETE
  • 5,964
  • 15
  • 85
  • 143

1 Answers1

0

Why don't you give this solution a look.

    public class Length
{
    private double const MillimetersPerInch = 25.4;
    private double _Millimeters;

    public static Length FromMillimeters(double mm)
    {
         return new Length { _Millimeters = mm };
    }

    public static Length FromInch(double inch)
    {
         return new Length { _Millimeters = inch * MillimetersPerInch };
    }

    public double Inch { get { return _Millimeters / MillimetersPerInch; } } 
    public double Millimeters { get { return _Millimeters; } }
}

.NET units class, inches to millimeters

Community
  • 1
  • 1
trueamerican420
  • 211
  • 2
  • 10