There is one deliverable for this assignment
This method must have the following header:
def __init__(self, name, country, issued):Both issued and value must be integers.
This method must have the following header:
def get_name(self):Returns the name of the stamp.
This method must have the following header:
def get_country(self):Returns the country that issued the stamp.
This method must have the following header:
def get_issued(self):Returns the year the stamp was issued.
This method must have the following header:
def get_value(self):Returns the value of the stamp.
This method must have the following header:
def set_value(self, value):Assigns a value to the value attribute.
This method must have the following header:
def __str__(self):Returns a string containing all attribute values.
This method must have the following header:
def __gt__(self, other):Returns True if the the object's value for value is greater than the other object's value for value.
This method must have the following header:
def __lt__(self, other):Returns True if the the object's value for value is less than the other object's value for value.
This method must have the following header:
def __eq__(self, other):Returns True if the the object's value for value is equal to the other object's value for value.
This method must have the following header:
def __ne__(self, other):Returns True if the the object's value for value is not equal to the other object's value for value.
Open an a text editor and create the file hw10.py.
You can use the editor built into IDLE or a program like Sublime.
Your hw10.py file must contain the following test code at the bottom of the file:
s1 = Stamp("1c Benjamin Franklin Z Gril", "US", 1868) print(s1.get_name()) print(s1.get_country()) print(s1.get_issued()) print(s1.get_value()) s1.set_value(935000) print(s1.get_value()) s2 = Stamp("3c George Washington w/ B Gril", "US", 1867) s2.set_value(900000) print(s2) print("s1 > s2 :", s1 > s2) print("s1 < s2 :", s1 < s2) print("s1 == s2 :", s1 == s2) print("s1 != s2 :", s1 != s2)
You should see
$ ./hw10.py 1c Benjamin Franklin Z Gril US 1868 0 935000 3c George Washington w/ B Gril, US, 1867, $900000 s1 > s2 : True s1 < s2 : False s1 == s2 : False s1 != s2 : True
Write this program in a step-by-step fashion using the technique of incremental development .
In other words, write a bit of code, test it, make whatever changes you need to get it working, and go on to the next step.
True
if the value of the object is greater than the value of the other
object. True
if the value of the object is less than the value of the other object. True
if the value of the object is equal the value of the other object. True
if the value of the object is not equal the value of the other object. 1c Benjamin Franklin Z Gril US 1868 0 935000 3c George Washington w/ B Gril, US, 1867, $900000 s1 > s2 : True s1 < s2 : False s1 == s2 : False s1 != s2 : True
cd 117
cd hw
cd hw10
chmod 755 hw10.py
Copyright © 2021 Glenn Hoffman. All rights reserved. May not be reproduced without permission.