CS 115 Program 1 Fall 2006

  • Expand on the design given below. That is, give more of the details at each step. Put this design in a text file called "design1.txt".
    1. Get the fractions from the user.
        1.1 get the first fraction from the user
            1.1.1 get numerator and denominator separately
        1.2 get the second fraction from the user
            1.2.1 get numerator and denominator separately
    2. Show the value of the two fractions in both forms
         2.1 Show the numerator and a / and the denominator of first fraction as integers
         2.2 force a floating point division with a typecast for 1st fraction to show decimal form
         2.3 Show the numerator and a / and the denominator of second fraction as integers
         2.4 find the floating point division forced with a typecast for 2nd fraction and display in decimal form
    3. Calculate the sum and display it in both forms
        3.1 sum of two fractions is num1 * den2 + num2 * den1 divided by product of dens
        3.2 display num1 * den2 + num2 * den1 then a / then product of dens
        3.3 find the floating point result of division and display
    4. Calculate the difference and display it in both forms
        4.1 difference of two fractions is num1 * den2 - num2 * den1 divided by product of dens
        4.2 display num1 * den2 - num2 * den1 then a / then product of dens
        4.3 find the floating point result of division and display
    5. Calculate the product and display it in both forms
        5.1 product of two fractions is product of nums divided by product of dens
        5.2 display product of nums then a / then product of dens
        5.3 find the floating point result of division and display
    6. Calculate the quotient and display it in both forms
        6.1 quotient of two fractions is num1 * den2 divided by num2 * den1
        6.2 display num1 * den2 then a / then num2 * den1
        6.3 find the floating point result of division and display