FOR PYTHON 3.2. Design a class named Fraction that contains: - A private float data field named numerator - A private float data field named
FOR PYTHON 3.2. Design a class named Fraction that contains:
- A private float data field named numerator
- A private float data field named denominator
- A constructor that creates a fraction object
- Get and set methods for getting/setting each of the data fields
- Overload method for printing a Fraction object. If z is a fraction with a numerator of 2 and denominator of 5, then print(z) should display 2/5
-Overload method for the multiplication operator (*). This method should return an object of type Fraction. Do not need to simplify the fraction.
Write a test portion (main) that will:
-Create 2 Fraction object
- Print each of them to the shell
-Multiply them and print result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started