SimonStnnFractions 1.0.0
See the version list below for details.
dotnet add package SimonStnnFractions --version 1.0.0
NuGet\Install-Package SimonStnnFractions -Version 1.0.0
<PackageReference Include="SimonStnnFractions" Version="1.0.0" />
paket add SimonStnnFractions --version 1.0.0
#r "nuget: SimonStnnFractions, 1.0.0"
// Install SimonStnnFractions as a Cake Addin #addin nuget:?package=SimonStnnFractions&version=1.0.0 // Install SimonStnnFractions as a Cake Tool #tool nuget:?package=SimonStnnFractions&version=1.0.0
<h1 align="center">Fractions Calculator</h1>
<p align="center"> Fractions program for Object Oriented Programming Evaluatie 3 </p>
Table of Contents
Fractions Library
The Fractions library is a simple library that allows you to perform basic arithmetic operations on fractions. The library provides a Fraction
class that represents a fraction with a numerator and a denominator. The Fraction
class provides methods to add, subtract, multiply, and divide fractions, as well as methods to simplify and invert fractions.
UML Diagram
classDiagram
class Fraction{
- _numerator: int
- _denominator: int
+ << get/set >> Numerator: int
+ << get/set >> Denominator: int
+ Fraction()
+ Fraction(int numerator, int denominator)
+ Add(right: Fraction) Fraction
+ Subtract(right: Fraction) Fraction
+ Multiply(right: Fraction) Fraction
+ Divide(right: Fraction) Fraction
+ Reciprocal() Fraction
+ Invert() Fraction
+ Simplify() Fraction
+ Result() double
+ ToString() string
}
Atributes
_numerator
: The numerator of the fraction._denominator
: The denominator of the fraction.
Properties
Numerator
: The property to get and set the numerator of the fraction.Denominator
: The property to get and set the denominator of the fraction.
Constructors
Fraction()
: The default constructor that initializes the fraction to1/1
.Fraction(int numerator, int denominator)
: The constructor that initializes the fraction to the given numerator and denominator.
Methods
Add(right: Fraction) Fraction
: Adds the given fraction to the current fraction. Returns a new fraction.Subtract(right: Fraction) Fraction
: Subtracts the given fraction from the current fraction. Returns a new fraction.Multiply(right: Fraction) Fraction
: Multiplies the given fraction with the current fraction. Returns a new fraction.Divide(right: Fraction) Fraction
: Divides the current fraction by the given fraction. Returns a new fraction.Reciprocal() Fraction
: Returns the reciprocal of the current fraction as a new fraction.Invert() Fraction
: Inverts the current fraction.Simplify() Fraction
: Simplifies the current fraction.Result() double
: Returns the result of the fraction as a double.ToString() string
: Returns the string representation of the fraction in the formatnumerator/denominator
. (e.g.1/2
)
Setup and Usage
To run this application you need to have the .NET 6.0 SDK and Visual Studio installed on your machine.
To use the Fractions library, you need to include the Fraction.cs
file in your project. You can then create instances of the Fraction
class and perform arithmetic operations on them.
Here is an example of how to use the Fractions library:
Fraction a = new Fraction(1, 2);
Fraction b = new Fraction(3, 4);
Fraction c = a.Add(b);
Fraction d = a.Subtract(b);
Fraction e = a.Multiply(b);
Fraction f = a.Divide(b);
Console.WriteLine($"a = {a}");
Console.WriteLine($"b = {b}");
Console.WriteLine($"a + b = {c}");
Console.WriteLine($"a - b = {d}");
Console.WriteLine($"a * b = {e}");
Console.WriteLine($"a / b = {f}");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.