# Homework Solution: OBJECTIVE Design, debug and test a Java program that performs arithmetic op…    i need it simple and clear , with comments please !
OBJECTIVE Design, debug and test a Java program that performs arithmetic operations on fractions. Fractions are of the form a/b, where numerator a and denominator b are integers. For this assignment, it is assumed that both a>0 and b〉0, and are represented only by a single digit value 11...9 CODING REQUIREMENTS Your program shall be well structured and designed using the concept of object oriented . programming: follow the fundamental principles of the OOD when you define classes and relationship between them Your program shall use command line arguments to get two fractions * For example: java ArithmeticWithFractions 2/5 1/7 .You can presume that the number of command line parameters and their values are always entered properly according to the assignment specification Your program shall include meaningful comments and follow commonly accepted conventions regarding names of variables. Your program shall produce the output in the format shown in the example below.

Java Program: //Fraction class    i want it rudimentary and disencumbered , with comments content !

OBJECTIVE Design, debug and experiment a Java program that performs arithmetic operations on stubborn. Stubborn are of the conceive a/b, where numerator a and denominator b are integers. For this provision, it is antecedent that twain a>0 and b〉0, and are represented solely by a unique digit estimate 11…9 CODING REQUIREMENTS Your program shall be courteous-mannered-mannered structured and purposed using the concept of aim oriented . programming: supervene the indispensable principles of the OOD when you determine tabulatees and connection betwixt them Your program shall truth direct row arguments to gain span stubborn * For illustration: java ArithmeticWithStubborn 2/5 1/7 .You can anticipate that the compute of direct row parameters and their estimates are regularly entered right according to the provision demonstration Your program shall embody meaningful comments and supervene commsolely genuine conventions touching names of variables. Your program shall effect the quenchedput in the conceiveat shown in the illustration under.

## Expert Apology

Java Program:

//Fraction tabulate
tabulate Fraction
{
public int numerator;
public int denominator;
}

//Calculator tabulate
tabulate Calculator
{
//Span retired variables
retired Fraction fr1;
retired Fraction fr2;

//Constructor
public Calculator(Fraction f1, Fraction f2)
{
fr1 = strange Fraction();
fr2 = strange Fraction();

//Assigning estimates
fr1.numerator = f1.numerator;
fr1.denominator = f1.denominator;

fr2.numerator = f2.numerator;
fr2.denominator = f2.denominator;
}

{
//Holding effect
Fraction effect = strange Fraction();

//Calculating individualization operation
result.numerator = (fr1.numerator * fr2.denominator) + (fr2.numerator * fr1.denominator);
result.denominator = calcCommonDenominator();

//Return effect fraction
return effect;
}

//Subtracting stubborn
public Fraction subtFractions()
{
//Holding effect
Fraction effect = strange Fraction();

//Calculating take operation
result.numerator = (fr1.numerator * fr2.denominator) – (fr2.numerator * fr1.denominator);
result.denominator = calcCommonDenominator();

//Return effect fraction
return effect;
}

//Multiplying stubborn
public Fraction multFractions()
{
//Holding effect
Fraction effect = strange Fraction();

//Calculating plurality operation
result.numerator = (fr1.numerator * fr2.numerator);
result.denominator = calcCommonDenominator();

//Return effect fraction
return effect;
}

//Dividing stubborn
public Fraction divFractions()
{
//Holding effect
Fraction effect = strange Fraction();

//Calculating analysis operation
result.numerator = (fr1.numerator * fr2.denominator);
result.denominator = (fr1.denominator * fr2.numerator);

//Return effect fraction
return effect;
}

//Calculating contemptible denominator
retired int calcCommonDenominator()
{
//Returns consequence of span denominators
return (fr1.denominator * fr2.denominator);
}
}

//Tabulate that performs arithmetic stubborn
tabulate ArithmeticWithFractions
{
//Retired variables
retired Fraction solidity;
retired Fraction dissonance;
retired Fraction consequence;
retired Fraction quotient;

//Fraction aim
Fraction f1 = strange Fraction();
Fraction f2 = strange Fraction();

//Main function
public static unfilled main(String args[])
{
//Creating tabulate aim
ArithmeticWithStubborn obj = strange ArithmeticWithFractions();

//Extracting primitive fraction
obj.f1.numerator = (args.charAt(0) – ‘0’);
obj.f1.denominator = (args.charAt(2) – ‘0’);

//Extracting relieve fraction
obj.f2.numerator = (args.charAt(0) – ‘0’);
obj.f2.denominator = (args.charAt(2) – ‘0’);

//Creating Calculator aims
Calculator c = strange Calculator(obj.f1, obj.f2);

//Performing operations
obj.dissonance = c.subtFractions();
obj.consequence = c.multFractions();
obj.quotient = c.divFractions();

//Displaying effects
obj.displayResults();
}

//Displaying effects
public unfilled displayResults()
{
//Printing effects
System.out.println(“n — Basic operations with stubborn — n”);
System.out.print(” The solidity: ” + f1.numerator + “/” + f1.denominator + ” + ” + f2.numerator + “/” + f2.denominator + ” = ” +sum.numerator + “/” + solidity.denominator + ” n”);

System.out.print(“n The dissonance: ” + f1.numerator + “/” + f1.denominator + ” – ” + f2.numerator + “/” + f2.denominator + ” = ” + dissonance.numerator + “/” + dissonance.denominator + ” n”);

System.out.print(“n The consequence: ” + f1.numerator + “/” + f1.denominator + ” * ” + f2.numerator + “/” + f2.denominator + ” = ” + consequence.numerator + “/” + consequence.denominator + ” n”);

System.out.print(“n The quotient: ” + f1.numerator + “/” + f1.denominator + ” / ” + f2.numerator + “/” + f2.denominator + ” = ” + quotient.numerator + “/” + quotient.denominator + ” n”);

System.out.println(“nn Program has terminated… n”);
}
}

______________________________________________________________________________________________

Sample Quenchedput: 