Consider the following code segment: class Employee : def _…

Consider the following code segment: class Employee : def __init__(self, name: str) -> None: . . . def getSalary(self) : . . . . . . class Programmer(Employee) : def __init__(self, name: str) -> None: . . . def writeProgram(self) : . . . Which of the following code segments is not legal?

Consider the following animal hierarchy. class Animal:    de…

Consider the following animal hierarchy. class Animal:    def __init__(self, name: str, age: int) -> None:        self._name = name        self._age = age     def speak(self) -> str:        raise NotImplementedError(“bad”) class Dog(Animal):    def speak(self) -> str:        return “woof”     def __repr__(self) -> str:        return f”Dog(name={self._name}, age={self._age}, sound={self.speak()})” class Cat(Animal):    def speak(self) -> str:        return “meow”     def __repr__(self) -> str:        return f”Cat(name={self._name}, age={self._age}, sound={self.speak()})” def main() -> None:    animals: list[Animal] = [ Dog(“Rex”, 5), Cat(“Milo”, 2) ]    print(animals) main() What gets printed when the main is run?

Consider the following task hierarchy — representing some u…

Consider the following task hierarchy — representing some unit of work to be completed. class Task:    def __init__(self, label: str) -> None:        self._label = label     def cost(self) -> int:        raise NotImplementedError(“bad”) class FixedTask(Task):    def __init__(self, label: str, minutes: int) -> None:        super().__init__(label)        self._minutes = minutes     def cost(self) -> int:        return self._minutes * 2     def __repr__(self) -> str:        return f”FixedTask(label={self._label}, cost={self.cost()})” def main() -> None:    items: list[Task] = [ FixedTask(“x”, 10), FixedTask(“y”, 3) ]    for t in items:        print(t) main() What prints?