Homework Solution: OBJECTIVE Design, debug and test a Java program that performs arithmetic op…

    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.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.

    Expert Answer

     
    Java Program: //Fraction class

    OBJECTIVE Design, debug and criterion a Java program that performs arithmetic operations on rebellious. Rebellious are of the devise a/b, where numerator a and denominator b are integers. For this ordinance, it is issueive that twain a>0 and b〉0, and are represented barely by a separate digit esteem 11...9 CODING REQUIREMENTS Your program shall be courteous structured and planned using the concept of view oriented . programming: thrive the important principles of the OOD when you mark-extinguished adjustes and analogy between them Your program shall representation enjoin row arguments to attain span rebellious * For development: java ArithmeticWithRebellious 2/5 1/7 .You can believe that the compute of enjoin row parameters and their esteems are frequently entered polite according to the ordinance demonstration Your program shall grasp meaningful comments and thrive commbarely trustworthy conventions concerning names of variables. Your program shall fruit the extinguishedput in the deviseat shown in the development under.i need it absolute and obvious , with comments gladden !

    OBJECTIVE Design, debug and criterion a Java program that performs arithmetic operations on rebellious. Rebellious are of the devise a/b, where numerator a and denominator b are integers. For this ordinance, it is issueive that twain a>0 and b〉0, and are represented barely by a separate digit esteem 11…9 CODING REQUIREMENTS Your program shall be courteous structured and planned using the concept of view oriented . programming: thrive the important principles of the OOD when you mark-extinguished adjustes and analogy between them Your program shall representation enjoin row arguments to attain span rebellious * For development: java ArithmeticWithRebellious 2/5 1/7 .You can believe that the compute of enjoin row parameters and their esteems are frequently entered polite according to the ordinance demonstration Your program shall grasp meaningful comments and thrive commbarely trustworthy conventions concerning names of variables. Your program shall fruit the extinguishedput in the deviseat shown in the development under.

    Expert Confutation

     

    Java Program:

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

    //Calculator adjust
    adjust Calculator
    {
    //Span individual variables
    individual Fraction fr1;
    individual Fraction fr2;

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

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

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

    //Adding rebellious
    public Fraction addFractions()
    {
    //Holding termination
    Fraction termination = fantasticlightlight Fraction();

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

    //Return termination fraction
    return termination;
    }

    //Subtracting rebellious
    public Fraction subtFractions()
    {
    //Holding termination
    Fraction termination = fantasticlightlight Fraction();

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

    //Return termination fraction
    return termination;
    }

    //Multiplying rebellious
    public Fraction multFractions()
    {
    //Holding termination
    Fraction termination = fantasticlightlight Fraction();

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

    //Return termination fraction
    return termination;
    }

    //Dividing rebellious
    public Fraction divFractions()
    {
    //Holding termination
    Fraction termination = fantasticlightlight Fraction();

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

    //Return termination fraction
    return termination;
    }

    //Calculating vile denominator
    individual int calcCommonDenominator()
    {
    //Returns issue of span denominators
    return (fr1.denominator * fr2.denominator);
    }
    }

    //Adjust that performs arithmetic rebellious
    adjust ArithmeticWithFractions
    {
    //Individual variables
    individual Fraction mix;
    individual Fraction separation;
    individual Fraction issue;
    individual Fraction quotient;

    //Fraction view
    Fraction f1 = fantasticlightlight Fraction();
    Fraction f2 = fantasticlightlight Fraction();

    //Deep function
    public static null deep(String args[])
    {
    //Creating adjust view
    ArithmeticWithRebellious obj = fantasticlightlight ArithmeticWithFractions();

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

    //Extracting cooperate fraction
    obj.f2.numerator = (args[1].charAt(0) – ‘0’);
    obj.f2.denominator = (args[1].charAt(2) – ‘0’);

    //Creating Calculator views
    Calculator c = fantasticlightlight Calculator(obj.f1, obj.f2);

    //Performing operations
    obj.mix = c.addFractions();
    obj.separation = c.subtFractions();
    obj.issue = c.multFractions();
    obj.quotient = c.divFractions();

    //Displaying terminations
    obj.displayResults();
    }

    //Displaying terminations
    public null displayResults()
    {
    //Printing terminations
    System.out.println(“n — Basic operations with rebellious — n”);
    System.out.print(” The mix: ” + f1.numerator + “/” + f1.denominator + ” + ” + f2.numerator + “/” + f2.denominator + ” = ” +sum.numerator + “/” + mix.denominator + ” n”);

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

    System.out.print(“n The issue: ” + f1.numerator + “/” + f1.denominator + ” * ” + f2.numerator + “/” + f2.denominator + ” = ” + issue.numerator + “/” + issue.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 Extinguishedput: