subject

An odometer is the gauge on your car that measures distance traveled. In the United States, an odometer measures in miles; elsewhere else, it measures kilometers. Many vehicles with electronic odometer interfaces can switch between miles and kilometers. Something to consider: if an odometer gets replaced, a new one must be able to be set to some specified mileage. a) Write an Odometer class which must include the following methods: • _init__, _str_1_repr__, overloaded add and substract method The constructor must take two arguments mileage, and any other specification that uses units (you choose the unit specification) . Both arguments must have a default value (you may choose the default values) O Addition and subtraction both have one odometer operand and one numeric operand, where the numeric operand represents the miles being added/subtracted (not two odometer operands). o Addition should be commutative (but not subtraction). o Output methods should always be rounded to 1/10 mile (kilometer), but the odometer itself should maintain full floating-point accuracy. b) Include sample code that uses your class and demonstrates the use of all methods as well as demonstrating error handling. c) at the end of your code show an illustrated run of your code "W" "

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:00
When is a chart legend used a. all the time b. whenever you are comparing data that is the same c. whenever you are comparing multiple sets of data d. only for hand-drawn charts
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
What is html ? give a small description about html
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
question
Computers and Technology, 24.06.2019 02:50
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
You know the right answer?
An odometer is the gauge on your car that measures distance traveled. In the United States, an odome...
Questions
question
Mathematics, 05.09.2020 21:01
question
History, 05.09.2020 21:01
Questions on the website: 13722367