Answer & Explanation:Assignment details is in the attached PDF. End result should look like the images shown in the pdf. Please let me know if you have any questions.
lab_6_question.pdf
Unformatted Attachment Preview
ITSE 1430 – Intro to C# Programming
Lab #6 – Simplify Fractions
This program asks the user for the numerator and denominator of a fraction. It
stores the fraction in a class object as a whole number and a simplified fraction.
To do that, the program will implement the Fraction class specified in the UML
class diagram below.
Requirements
1. Create a Fraction class according the specification above.
2. The Frraction constructor will call simplify, so that fraction objects are
always stored in simplified form. The constructor will check to see if the
denominator is zero. If it is it will display a message and exit the program
using Environment.Exit(0).
3. For this program simplified form means a mixed number, a whole number
and a simplified proper fraction.
4. The simplify method will convert the fraction to a mixed number by dividing
numerator by the denominator. The new numerator is the remainder
numerator % denominator. So if the numerator is 22 and the denominator
is 8, simplify converts that to 2 6/8.
5. The simplify function then simplifies the fraction by dividing both the
numerator and the denominator by their Greatest Common Divisor (GCD).
© Paul Koester, Dallas County Community College, 2019
6. The gcd method must use Euclid’s method for finding the GCD.
7. Euclid’s method is a recursive method defined as:
gcd(a, b)
if b = 0
return a
else
return gcd(b, a % b)
8. The getString method returns a string used to display the fraction. If the
whole number is 0, it omits the whole number, if the numerator is 0, then
the fraction part is omitted. Examples are, “3”, “3/4”, and “2 3/8”.
9. The main method requests a numerator and denominator. It creates a
Fraction object for that fraction, then displays the fraction as both a
simplified mixed number and a decimal number as shown below.
Hint
Create the class and then implement the methods in the following order, Fraction
constructor, getParts, getString, gcd, simplify, Main. The requirements above tell
you what to do for each method.
Sample Output
© Paul Koester, Dallas County Community College, 2019
Upload the C# files for both the Fraction class and the Main method to this
assignment.
© Paul Koester, Dallas County Community College, 2019
…
Purchase answer to see full
attachment
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more