Question: Could you help me write a basic java program following these instructions? Problem statement: Create a class named Fraction having two integer data members named
Problem statement: Create a class named Fraction having two integer data members named for a fraction's numerator and denominator. The class' default constructor should provide both data members with default values of 1 if no explicit initialization is provided. The constructor must also prohibit a 0 denominator value (Set it to 1). Include member functions for displaying an object's data values(e.g., SOP(fractionName) gives "Fraction 16/37), and mathematical functions capable of adding and subtracting two Fraction objecte (No need to reduce fractions.): // Sum formula: a/b+c/d = (ad + cb)/bd // Subtraction formula: a/b - c/d = (ad-cb)/bd
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
