OOP cbt grading
from datetime import date
import json
class CPT:
def __init__(self, category, ss, cbs, comments):
self._category = category # variables with self prefix become part of the object,
self._ss = ss
self._cbs = cbs
self._comments = comments
@property
def category(self):
return self._category
# a setter function, allows name to be updated after initial object creation
@category.setter
def category(self, category):
self._category = category
# a getter method, extracts email from object
@property
def ss(self):
return self._ss
# a setter function, allows name to be updated after initial object creation
@ss.setter
def ss(self, ss):
self._ss = ss
# check if uid parameter matches user id in object, return boolean
def is_ss(self, ss):
return self._ss == ss
@property
def cbs(self):
return self._cbs
# a setter function, allows name to be updated after initial object creation
@cbs.setter
def cbs(self, cbs):
self._cbs = cbs
# check if uid parameter matches user id in object, return boolean
def is_cbs(self, cbs):
return self._cbs == cbs
@property
def comments(self):
return self._comments
# a setter function, allows classOf to be updated after initial object creation
@comments.setter
def comments(self, comments):
self._comments = comments
# dictionary is customized, removing password for security purposes
@property
def dictionary(self):
dict = {
"category" : self.category,
"ss" : self.ss,
"cbs" : self.cbs,
"comments" : self.comments
}
return dict
# output content using json dumps, this is ready for API response
def __str__(self):
return json.dumps(self.dictionary)
# output command to recreate the object, uses attribute directly
def __repr__(self):
return f'CPT(category={self._category}, ss={self._ss}, cbs={self._cbs},comments={self._comments})'
if __name__ == "__main__":
u1 = CPT(category='reporting category', ss='1', cbs='1', comments='I think this person deserved the point for this category because they described the functionality and purpose as well as the actual functions and the input and output. Collegeboard agreed.')
u2 = CPT(category='data abstraction', ss='1', cbs='0', comments='I think the person described the point for this category because they gave two code segments and identified a list and its purpose, but collegeboard disagreed because they did not access the data from the list')
u3 = CPT(category='managing complexity', ss='0', cbs='0', comments='I did not think the person deserved this point because the list does not especially manage complexity or explain well how the complexity managed is essential to the programs function. Collegeboard agreed.')
u4 = CPT(category='procedural abstraction', ss='0', cbs='0', comments='I did not think the person deserved this point because they did not say how the procedure they gave with the parameter was essential to the program although they hit the other criteria, which collegeboard agreed with. ')
u5 = CPT(category='algorithm implementation', ss='1', cbs='1', comments='Includes sequencing, selection, and iteration and gives enough description that it can be recreated so i think they deserved the point, which collegeboard agreed with')
u6 = CPT(category='testing', ss='1', cbs='1', comments='Gives two calls, the procedure for each and the output, which is everything required for this category- so the person deserves the point, which collegeboard agreed')
print("\n", u1, "\n")
print("\n", u2, "\n")
print("\n", u3, "\n")
print("\n", u4, "\n")
print("\n", u5, "\n")
print("\n", u6, "\n")
from datetime import date
import json
class CPT:
def __init__(self, category, ss, cbs, comments):
self._category = category # variables with self prefix become part of the object,
self._ss = ss
self._cbs = cbs
self._comments = comments
@property
def category(self):
return self._category
# a setter function, allows name to be updated after initial object creation
@category.setter
def category(self, category):
self._category = category
# a getter method, extracts email from object
@property
def ss(self):
return self._ss
# a setter function, allows name to be updated after initial object creation
@ss.setter
def ss(self, ss):
self._ss = ss
# check if uid parameter matches user id in object, return boolean
def is_ss(self, ss):
return self._ss == ss
@property
def cbs(self):
return self._cbs
# a setter function, allows name to be updated after initial object creation
@cbs.setter
def cbs(self, cbs):
self._cbs = cbs
# check if uid parameter matches user id in object, return boolean
def is_cbs(self, cbs):
return self._cbs == cbs
@property
def comments(self):
return self._comments
# a setter function, allows classOf to be updated after initial object creation
@comments.setter
def comments(self, comments):
self._comments = comments
# dictionary is customized, removing password for security purposes
@property
def dictionary(self):
dict = {
"category" : self.category,
"ss" : self.ss,
"cbs" : self.cbs,
"comments" : self.comments
}
return dict
# output content using json dumps, this is ready for API response
def __str__(self):
return json.dumps(self.dictionary)
# output command to recreate the object, uses attribute directly
def __repr__(self):
return f'CPT(category={self._category}, ss={self._ss}, cbs={self._cbs},comments={self._comments})'
if __name__ == "__main__":
u1 = CPT(category='reporting category', ss='1', cbs='1', comments='Shows running, gives input and output and functionality and purpose with a good thorough explanation. I would give them the point and so would collegeboard.')
u2 = CPT(category='data abstraction', ss='1', cbs='1', comments='It gives two clear and different code segments with the name of the list and a description of whats in it with enough explanation that I think they deserve the point (and collegeboard did too)')
u3 = CPT(category='managing complexity', ss='1', cbs='1', comments='I thought the student deserved the point for this because they included code to manage complexity and explained why it was necessary, which collegeboard agreed with.')
u4 = CPT(category='procedural abstraction', ss='1', cbs='1', comments='Gives procedure, parameter, and call and describes the procedure and how it functions, so they deserved the point, which collegeboard gave them ')
u5 = CPT(category='algorithm implementation', ss='1', cbs='1', comments='IThe algorithm contains all three essential attributes and a good enough description that the program could be recreated, which is why they deserve the point and collegeboard gave it to them')
u6 = CPT(category='testing', ss='1', cbs='1', comments='This person deserves the point because there are two different calls with results (different results, proving importance of each) and gives what conditions are being tested. Collegeboard agreed. ')
print("\n", u1, "\n")
print("\n", u2, "\n")
print("\n", u3, "\n")
print("\n", u4, "\n")
print("\n", u5, "\n")
print("\n", u6, "\n")
from datetime import date
import json
class CPT:
def __init__(self, category, ss, cbs, comments):
self._category = category # variables with self prefix become part of the object,
self._ss = ss
self._cbs = cbs
self._comments = comments
@property
def category(self):
return self._category
# a setter function, allows name to be updated after initial object creation
@category.setter
def category(self, category):
self._category = category
# a getter method, extracts email from object
@property
def ss(self):
return self._ss
# a setter function, allows name to be updated after initial object creation
@ss.setter
def ss(self, ss):
self._ss = ss
# check if uid parameter matches user id in object, return boolean
def is_ss(self, ss):
return self._ss == ss
@property
def cbs(self):
return self._cbs
# a setter function, allows name to be updated after initial object creation
@cbs.setter
def cbs(self, cbs):
self._cbs = cbs
# check if uid parameter matches user id in object, return boolean
def is_cbs(self, cbs):
return self._cbs == cbs
@property
def comments(self):
return self._comments
# a setter function, allows classOf to be updated after initial object creation
@comments.setter
def comments(self, comments):
self._comments = comments
# dictionary is customized, removing password for security purposes
@property
def dictionary(self):
dict = {
"category" : self.category,
"ss" : self.ss,
"cbs" : self.cbs,
"comments" : self.comments
}
return dict
# output content using json dumps, this is ready for API response
def __str__(self):
return json.dumps(self.dictionary)
# output command to recreate the object, uses attribute directly
def __repr__(self):
return f'CPT(category={self._category}, ss={self._ss}, cbs={self._cbs},comments={self._comments})'
if __name__ == "__main__":
u1 = CPT(category='reporting category', ss='1', cbs='1', comments='Describes functionality, input and output, and purpose, and the video correlates with the description and shows the program running successfully. This category meets all the criteria, so they deserve the point, which Collegeboard agrees with. ')
u2 = CPT(category='data abstraction', ss='0', cbs='0', comments='The code doesnt really show data stored in the list or being used from the list and the description at the end seems like it doesnt add up, so I dont think the person deserved this point. Collegeboard agreed and said that the problem was that it was the wrong list being described in the end piece.')
u3 = CPT(category='managing complexity', ss='0', cbs='0', comments='The response this person gives about why the complexity needs to be managed could apply to any piece of code. It is incredibly generic and not deserving of the point, which collegeboard agreed with. ')
u4 = CPT(category='procedural abstraction', ss='0', cbs='0', comments='There are no parameters or calls and the procedure seems to be described incorrectly because it says the state screen is updated when it doesn’t appear to be. Collegeboard agreed and said they also did not describe how this piece helps the overall functionality ')
u5 = CPT(category='algorithm implementation', ss='0', cbs='0', comments='There is no iteration, so I did not think the person deserved this point. Collegeboard also said that the algorithm description is not complete.')
u6 = CPT(category='testing', ss='0', cbs='0', comments='This section describes what the person is doing, not what they are testing, and it does not give the results, so I don’t think they deserved the point. Collegeboard said they also called from, not to, and there was no implicit parameter. ')
print("\n", u1, "\n")
print("\n", u2, "\n")
print("\n", u3, "\n")
print("\n", u4, "\n")
print("\n", u5, "\n")
print("\n", u6, "\n")
from datetime import date
import json
class CPT:
def __init__(self, category, ss, cbs, comments):
self._category = category # variables with self prefix become part of the object,
self._ss = ss
self._cbs = cbs
self._comments = comments
@property
def category(self):
return self._category
# a setter function, allows name to be updated after initial object creation
@category.setter
def category(self, category):
self._category = category
# a getter method, extracts email from object
@property
def ss(self):
return self._ss
# a setter function, allows name to be updated after initial object creation
@ss.setter
def ss(self, ss):
self._ss = ss
# check if uid parameter matches user id in object, return boolean
def is_ss(self, ss):
return self._ss == ss
@property
def cbs(self):
return self._cbs
# a setter function, allows name to be updated after initial object creation
@cbs.setter
def cbs(self, cbs):
self._cbs = cbs
# check if uid parameter matches user id in object, return boolean
def is_cbs(self, cbs):
return self._cbs == cbs
@property
def comments(self):
return self._comments
# a setter function, allows classOf to be updated after initial object creation
@comments.setter
def comments(self, comments):
self._comments = comments
# dictionary is customized, removing password for security purposes
@property
def dictionary(self):
dict = {
"category" : self.category,
"ss" : self.ss,
"cbs" : self.cbs,
"comments" : self.comments
}
return dict
# output content using json dumps, this is ready for API response
def __str__(self):
return json.dumps(self.dictionary)
# output command to recreate the object, uses attribute directly
def __repr__(self):
return f'CPT(category={self._category}, ss={self._ss}, cbs={self._cbs},comments={self._comments})'
if __name__ == "__main__":
u1 = CPT(category='reporting category', ss='1', cbs='1', comments='Describes functionality, input and output, and purpose, and the video correlates with the description and shows the program running successfully. This category meets all the criteria, so they deserve the point, which Collegeboard agrees with. ')
u2 = CPT(category='data abstraction', ss='1', cbs='1', comments='It gives two clear and different code segments with the name of the list and a description of whats in it with enough explanation that I think they deserve the point (and collegeboard did too)')
u3 = CPT(category='managing complexity', ss='1', cbs='1', comments='I thought the student deserved the point for this because they included code to manage complexity and explained why it was necessary, which collegeboard agreed with. ')
u4 = CPT(category='procedural abstraction', ss='1', cbs='1', comments='Gives procedure, parameter, and call and describes the procedure and how it functions, so they deserved the point, which collegeboard gave them')
u5 = CPT(category='algorithm implementation', ss='1', cbs='1', comments='The algorithm contains all three essential attributes and a good enough description that the program could be recreated, which is why they deserve the point and collegeboard gave it to them')
u6 = CPT(category='testing', ss='0', cbs='0', comments='Results are not given and the person does not talk about the arguments that are going through the parameters. According to collegeboard, the description of conditions being tested was also lacking, so they did not get or deserve this point. ')
print("\n", u1, "\n")
print("\n", u2, "\n")
print("\n", u3, "\n")
print("\n", u4, "\n")
print("\n", u5, "\n")
print("\n", u6, "\n")