Question: Object Oriented Programming using python Problem 1: Fractions Create a simple class to represent a number as a fraction where your class will take the

Object Oriented Programming using python
Problem 1: Fractions
Create a simple class to represent a number as a fraction where your class will take the numerator and denominator as parameters.
Implement features to add, subtract, multiply, divide, return decimal value, and inverse your fraction object as indicated in the given file.
Create a CFraction class which has all the same features as the first fraction class (hint: subclass) but makes sure the fraction is in its most simplified form (e.g. 1/2 instead of 5/10).
Hint: to simplify fractions you will need the greatest common divisor, a non-recursive gcd() and recursive gcdr() functions are provided,
Please comment in a very brief explanation for gcd(), gcdr(), primeFactors(), and prod() on what the functions do. Refer to the wiki on Greatest Common Divisor.
Use the operations and print statements provided to test your code.
Problem 2: Furniture
You are given several classes relating to a home.
You need to calculate the total value of the house by adding the price of the house and all its furniture by adding prices to the furniture.
Idea: You might want to introduce a class "Furniture", with an attribute "value" and subclasses for sofa and table. To the house you may want to add a list of furniture.
Sort the houses by
1. total area
2. lexicographically by (rooms, size, owner)
3. total value
*** Reminders
For this lab please submit python files.
Please include your name in the header of the python files.
Use enter and tabs for indentation instead of spaces to avoid indentation errors.
Remember to test your code using the python console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!