Question: Question: Part A ) 1. Implement a class (eg, Fraction.java) for handling fractions. The Fraction class has two instance variables - an integer numerator and
Question:Part A)
1. Implement a class (eg, Fraction.java) for handling fractions. The Fraction class has two instance variables - an integer numerator and an integer denominator. The two instance variables can be publicly accessible. Supply an input method to get a fraction (as two separate integers) from the user. Supply an output method to print out the fraction on the screen. The fraction is to be outputted in the form: numerator/denominator. Half, for example, should be printed out as 1 / 2 and not 0.5.
Implement a client program (eg FractionDemo.java) to test your fraction class. The program should loop around getting fractions from the user and displaying them on the screen. Stop when the numerator is negative.
Note that the client program must use the fraction class methods to read and display fractions.
Provide the UML class diagram for the Fraction class - this can be submitted as a document file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
