Question
Design and implement a FootMeasure class that stores a linear measurement of feet and inches . Your class should have the following function header for
Design and implement a FootMeasure class that stores a linear measurement of feet and inches. Your class should have the following function header for special method __init__, def __init__(self, feet = 0, inches = 0)
Thus, the class should be able to create a FootMeasure object in various ways by use of optional keyword arguments, (if you don't know what a keyword argument is, there are a lot of resources for this as well)
I should be able to invoke your FootMeasure class in all the following ways! meas = FootMeasure() meas = FootMeasure(feet = 5) meas = FootMeasure(feet = 5, inches = 8) meas = FootMeasure(inches = 68)
Implement special method __repr__/__str__ in the class so that measurements are displayed as follows, (For this assignment __str__ and __repr__ will be the same). (When I call something like print)
5 ft. NOT 5 ft. 0 in. 5 ft. 8 in. NOT 68 in.
When the measurement is 0, it should be displayed as, 0 ft. 0 ins.
Include special method add() for adding FootMeasure values. FM1 +FM2
Also include all the special methods for implementing the relational operators (==, !=, <, <=, >, >=)
You should submit two files, your class file and your main file. Your main file will import your class file.
Your main file should showcase the use of all of your methods.
- show how you create your foot measure objects, show adding objects together, and show the use of the relational operators with those objects that you have created.
- you should use lots of print statements to fully explain and show to me that everything is working. you are essentially creating the driver file for this class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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