Page 1 of 1

Question 4: Managing the budget! (12 marks] B. A team cao coly speed an nouot if it does not exceed their budget. We wnt

Posted: Fri Apr 29, 2022 6:48 am
by answerhappygod
Question 4 Managing The Budget 12 Marks B A Team Cao Coly Speed An Nouot If It Does Not Exceed Their Budget We Wnt 1
Question 4 Managing The Budget 12 Marks B A Team Cao Coly Speed An Nouot If It Does Not Exceed Their Budget We Wnt 1 (94.57 KiB) Viewed 30 times
Question 4: Managing the budget! (12 marks] B. A team cao coly speed an nouot if it does not exceed their budget. We wnt to add a method can spend that takes anount as an input. The method retuus True if the amount does not creced the budget otherwisc it reticos False. It should work ca both employees and students as follows: ยป Tl.canSpend/3620 True >> T2.CHSX2050 False Sugvest in lie cuiteri de can be hest incidilied using 00P practices to support the new inercions shows hoxe. Redunda coxle v hotoCP practices will be penulisel. You cho not need to retite the entire classes if you can clearly state where code shoxlc headleclmoditie:l. [url] Consider the following classes 1 class Teart: 2 def inilisell) 3 sell.base bulgel = 1063 + 5 5 def get budgetsrif}: 3 return self.basr hudget 7 a class Testing Team)! det --init..selt)! 10 selt.testing budget - 2063 selt. frozen = False 12 13 def fretze budget (selri: 14 sell. froze = True 15 18 def get budget self}: 17 if self.frozen 18 return super get budget 19 return self. testing budget + super!).get_budget 20 21 class Developnenti Teore): 22 def --init.iselt): 23 sell.developrent budget - 4300 = 24 sell. frozen = False 25 25 def free budge(seln): 27 self. fraze = True 28 29 def get budgetsrifi: 30 if self.frozen: 31 return super.get budget return self.development_budget + super().get_budget! C. To micct i pressiile deadlines, many times about Sprint tcams are found that contains membe who de boli texting and developeel. Spent can be raised in one of the two way yill: class Sprint Developent, Testing): pass class Sprint2(Testing. Development) pass T3 - Sprinti) T4 = Sorint2! What will be the budget for team 13 and 14: What is the Method Resolution Order (MRO) for Sprint and Sprintz? (MRO is a sequcace in which the class hierarchy will be traversed to look for anothed) 14 marks D. Swipe the following lines. 12. freeze_budget() 13. freeze.budget() T1. freeze.budget() printit2.canSpend 2003) printi13. can spend (2003) printiT4. Car Spend (2003) 13 marks Question 5: 42 and the Meaning of Life [4 marks] A. Following cut cause all LIU W by the lo internete. Cil you identity the line casing the em? What should we change in the classes so that the entir land probably ful.in errongile ilway? - T1 - Develoonent print(Ti.get budge(1) > T2 = Test >>print(T2.get budget (1) [2 mark Tither: (l) explain www you think one will you have learni in CSIOIOS will be helpful iy you live the rest of your life and circles at NUS: chi tell us an interesting story about your experience with CSI00S this semester: [4 rurks! END OF PAPER 11 12