Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# programming. 2. Create a fractions class that represents fractions in the form a/b Your class should implement the following members int Numerator int Denominator

C# programming.

2. Create a fractions class that represents fractions in the form a/b Your class should implement the following members int Numerator int Denominator Fraction(int numerator, int denominator) - creates a new Fraction double ToDecimal() - returns the fraction as a double Fraction Add(Fraction f) - adds the fraction to the one passed in and simplifies the result Fraction Multiply(Fraction f) - multiplies the fraction by the one passed in and simplifies the result Fraction Simplify() - simplifies the fraction using the GreatestCommonDivisor method from the first Exercise Create a test program that demonstrates the following 1/2 = 0.5 1/7 + 1/5 = 12/35 1/4 * 2/3 * 4/5 = 2/15

Here is the GCD method I already wrote:

public static int GreatestCommonDivisor(int a, int b)

{ if (b == 0) return a; else return GreatestCommonDivisor(b, a % b); } } }

Thanks!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago