Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

Python代写|COMP1046 Object Oriented Programming

Python代写|COMP1046 Object Oriented Programming




In Assignment Part 2, OO Programming, you will work individually to implement a computer part store in Python. You will implement the classes and relationships that you designed in your UML diagram that you developed in Assignment Part 1, OO Design. while you are programming, you may find that parts of your UML design need to change. Please update your UML diagram to reflect the changes that you have made to your code. Your project, including your updated UML diagram, are due for submission in week 12.

If you are unsure about any instructions in this document, please ask your lecturer to explain.


Please open the provided folder in Visual Studio Code so that your Explorer tab looks like the red box in the screenshot below. This ensures that the database.csv file is at the top-level of the project – not inside a subfolder.You will write your program in “”. You will write a unittest or pytest for the PartList class in “”. Your PartList will need to load in the computer parts lists in “database.csv”. “TODO How To Start.txt” contains a reminder of the requirements and tasks that you need to complete.


Please ensure you do the following while writing your code. DO NOT wait until the end of the project to start these things. Do the following throughout the project while writing each class and each method.

  • Make a git commit after every major change (minimum 10). Ensure they have a descriptive commit message.
  • Test each method while writing each method. Comment out your tests after you know they are working.
  • Write doc strings in each class and each method (see Doc Strings section below).
  • Write inline comments to describe important sections of code.
  • Ensure you follow “Best Practice” (see Best Practice section below).
  • You must demonstrate multiple examples of inheritance, aggregation, composition, and association.
  • You must demonstrate polymorphism by calling overridden methods, or by checking the types of objects.
  • You must demonstrate good encapsulation by making variables private or protected and providing getter and/or setter methods to them.
  • You must demonstrate how to raise and handle exceptions.
  • You must update your UML diagram to reflect any changes made to your design.


Please complete the following tasks to complete the assignment:

  • Write academic integrity comment in “” (Modify the first comment in the file).
  • Write academic integrity comment in “” (Modify the first comment in the file).
  • Initialize git repository (Make commits after every major change (minimum 10)).
  • Write computer part class(es).
  • Write data structures class(es).
  • Write a unittest or a pytest for PartList class (see Unit Test section below).
  • Write user interface class(es).
  • Test thoroughly.
  • Ensure output matches sample output (see Sample Output section below).
  • Remove all “TODO” comments in code.


Please provide a descriptive docstring on the first line of each of your classes and methods. Docstrings are written in

”’triple quotes”’ on the first line inside a class or method, such as:

class ComputerPart(metaclass = abc.ABCMeta):

”’ The abstract ComputerPart class is the superclass for other ComputerPart types.


def __init__(self, name, price):

”’Initialises name and price. Called by subclasses using super().__init__()



#TODO initialise name and price

Document your code as you go, not all at the end. Write a brief docstring about the one thing that the method is supposed to do before you write the code. Refer to that docstring to remind yourself of the problem you need to solve or the code you need to write. This helps maintain focus when implementing the method and should stop you from making it do more than the one thing that the docstring says it should do.


Ensure you do the following or you may lose marks, especially for not implementing relationships correctly:

  • Avoid global variables. Write code in the main function() to construct your object(s) and start the program e.g.:

def main():

# TODO Write your main program code here…

print(“~~ Welcome to the Computer Store ~~”)


shop = ComputerPartShop() # Construct object

shop.command_prompt() # Call method to start the program

# Write the rest of your code inside classes…

  • Use self correctly e.g.:

class ComputerPart(metaclass = abc.ABCMeta):

def __init__(self, name, price):

self.set_price(price) # GOOD! Self as calling object.

ComputerPart.set_name(self, name) # BAD! Self as argument. Do not do this.

  • Avoid class-variables (you will not need them). Use instance-variables instead e.g.:

class ComputerPart(metaclass = abc.ABCMeta):

name = “AMD Ryzen 5” # BAD! This class-variable is unnecessary. Do not do this.

def __init__(self, name):

self.__name = name # GOOD! Instance-variables belong to self

  • Avoid circular imports. If this file imports that file and that file imports this file, we have a circular import.

Python cannot resolve circular imports. Avoid this by writing classes in one file.