June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to perform mathematical operations with fractions without converting to decimal notation (and possibly introducing rounding errors).
Create your own simple fraction class.
The .NET Framework does not include any built-in support for fraction calculations. However, it’s quite easy to create a class to represent vectors. This class will include methods such as Add, Subtract, Multiply, and DivideBy. It will also include a Normalize function that will reduce a fraction to lowest terms using Euclid’s algorithm and adjust its sign. In addition, the class will support cloning and comparing (useful for sorting arrays of fractions), and it will override the Equals method to perform ...
Read now
Unlock full access