Part A Create a UML diagram for the two classes contained in the Python files listed below. NO GRAPHIC FILE. participant
Posted: Sun May 15, 2022 10:03 am
Part A
Create a UML diagram for the two classes contained in the Python
files listed below. NO GRAPHIC FILE.
participant.py
class Participant:
def __init__(self, name, age, address):
self._name = name
self._age = age
self._street_address = address
self._test = 'test'
self.__test2 = 'test'
@property
def test2(self):
return self.__test2
@property
def name(self):
return self._name
@property
def age(self):
return self._age
@property
def street_address(self):
return self._street_address
def __str__(self):
return '{} {} {}'.format(self.name,
self.age, self.street_address)
runner.py
import participant
class Runner(participant.Participant):
def __init__(self, runner_name, runner_age,
runner_address, start_location,finish_location):
participant.Participant.__init__(self,runner_name,runner_age,runner_address)
self._start_location =
start_location
self._finish_location =
finish_location
@property
def start_location(self):
return self._start_location
@property
def finish_location(self):
return self._finish_location
def __lt__(self,other_runner):
return self.name <
other_runner.name
Part B
Write a client script (runner_client.py) that
uses the runner class. The program will create a list of five
runners. Once the runners are created, the program will print
each runner’s details.
Your program logic must include the
following:
2. When the loop completes, display
the runners(One runner per line)
Create a UML diagram for the two classes contained in the Python
files listed below. NO GRAPHIC FILE.
participant.py
class Participant:
def __init__(self, name, age, address):
self._name = name
self._age = age
self._street_address = address
self._test = 'test'
self.__test2 = 'test'
@property
def test2(self):
return self.__test2
@property
def name(self):
return self._name
@property
def age(self):
return self._age
@property
def street_address(self):
return self._street_address
def __str__(self):
return '{} {} {}'.format(self.name,
self.age, self.street_address)
runner.py
import participant
class Runner(participant.Participant):
def __init__(self, runner_name, runner_age,
runner_address, start_location,finish_location):
participant.Participant.__init__(self,runner_name,runner_age,runner_address)
self._start_location =
start_location
self._finish_location =
finish_location
@property
def start_location(self):
return self._start_location
@property
def finish_location(self):
return self._finish_location
def __lt__(self,other_runner):
return self.name <
other_runner.name
Part B
Write a client script (runner_client.py) that
uses the runner class. The program will create a list of five
runners. Once the runners are created, the program will print
each runner’s details.
Your program logic must include the
following:
2. When the loop completes, display
the runners(One runner per line)