Question: python Object Oriented Programming. Define a Hundred _ Number to be a number that can take any integer value between 0 and 9 9 .

python
Object Oriented Programming. Define a Hundred_Number to be a
number that can take any integer value between 0 and 99. If two Hundred_Numbers are added
and the result is a number greater than 99(e.g.137), only the digits in the 10s and 1s positions
(e.g.37) should be kept. Supply the missing class so that when this code is run:
import random
# The missing class goes here. Do not change any of the supplied code.
def main():
number_1= Hundred_Number(random.randint(0,100))
print(number_1)
number_2= Hundred_Number(random.randint(0,100))
print(number_2)
number_3= number_1+ number_2
print(number_3)
main()
This output might be produced:
The value =57
The value =87
The value =44
//
Hint: you need to define a method named __add__

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 Accounting Questions!