Question: Program 1 Write a program to calculate the sum, difference, product and quotient for two fractions. Using a scanner, the program should ask the user
Program 1
Write a program to calculate the sum, difference, product and quotient for two fractions. Using a scanner, the program should ask the user to input the numerator and denominator for each fraction and store that input as integers. Use the formulas from the Math 1 content in Module 1 to calculate the sum, difference, product and quotient for each fraction. Output the results to the user in the console along with the original fractions inputted as shown in the sample output shown below. The black font shows what your program should output to the user. Note that the input from the user is shown in a bold font. Also, the answer should be left as a fraction as shown in the sample output below.
Sample Output:
This program will calculate the sum, difference, product and quotient for two fractions.
Enter the numerator of the first fraction: 5
Enter the denominator of the first fraction: 6
Enter the numerator of the second fraction: 2
Enter the denominator of the second fraction: 3
Results:
5/6 + 2/3 = 27/18
5/6 2/3 = 3/18
5/6 * 2/3 = 10/18
(5/6)/(2/3) = 15/12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
