Construct the fraction class with 3 constructors. The first is the default. The second constructor should allow us to create a fraction that represents a whole number. The third constructor should allow us to specify the numerator and denominator of a new fraction object. The public functions should include functions for respectively getting the numerator and denominator, setting the respective numerator and denominator, multiplying fractions, and displaying the fraction.
You should then use this class in a program that multiplies fractions. (Hint: you can create 3 fraction objects f1, f2, and f3. You can use the public function readFraction that reads 2 fractions f1 and f2. You can then use the statement f3 = f1.multiply(f2) to calculate f1 * f2 and assign the result to f3.)
The function's input prompts should be "Enter 1st fraction" and "Enter 2nd fraction" where the user enters the appropriate fractions. In addition, the program needs to display the result of the multiplication operation in the readable format:
Recently Asked Questions
- Khirchoff's and Ohm's Law, calculate voltage and current, show details steps.
- How many types of Hepatitis are there? I know they are all viral but what is the main difference between the two big ones?
- Construct the confidence interval for the population mean mu c= 0.95 , x overbar = 16.3 , sigma = 8.0 , and n= 35 A 95 % confidence interval for mu is