I need help with a python assignment pleaseeeaseasease I dont get it

Task: The Wonky Conglomerate of Canada is planning to build a new factory to manufacture a variety of different widgets – new Wonky Widgets. They plan to assemble these widgets from parts that they manufacture elsewhere or acquire. They require an inventory processing system to support this new venture. They have a database of parts that they want to build widgets from, file parts.txt, that lists all available parts for widget construction. Each part in the file has a name, a price and the number of this part currently in stock. Each widget is constructed using a number of parts. The widgets to be built are stored in widgets.txt. In this assignment, you are required to develop a widget processing system. Given a list of widgets and their parts information and a list of parts and their prices/quantity on hand you are to determine if each widget can be build and if so its cost. You are required to update the parts inventory file when a quantity for a part becomes 0 by removing this part from the database. You need to sum the widget costs only for all widgets that can be constructed. Functional Specifications:

  1. Create a class Parts :  It should have instance variables, partName, partPrice and partQuantity; it may have others that you deem necessary.  It should have appropriate getter and setter methods for the instance variables.  It should have a constructor method with three parameters for the part name, price and quantity.  You may want to include an equals() method to determine if two parts are the same (i.e., have the same name).  You may add other methods that you deem useful.

  2. Create a class PartInventory :  It should have a local data structure, partsInventory, to store the parts inventory  You may include instance variables that you consider needed and have appropriate getter and setter methods.  You should have a method removePart that will take a Part as a parameter and remove it from the inventory database.  You may add other methods that you deem useful.

  3. Create a Python program, Main, that makes use of the above classes. This program should:  Create a PartsInventory object that using the parts.txt.  Process each widget in widgets.txt one at a time, and specifies:   Whether the widget can be built or not:  If the widget can be built (i.e., there are sufficient parts), then you should i. compute and print how much it would cost; ii. reduce the quantity of parts for that part in the database; iii. and, if the quantity of a part is 0, then remove that part from the database.  If the widget cannot be built (either because there are not sufficient parts OR the part is not in the database), then you should i. indicate which parts have insufficient inventory in the database or are not in the database at all (there can be more than one); ii. print a statement saying that it cannot be built.  The output should be "pretty" printed using formatted output; you should print the information about each widget (parts used, cost, etc.).  You should print the PartsInventory at the beginning before you process the widgets and at the end, after all the widgets have been processed. The widget file (widget.txt) has a number of widget specifications: The first line is the widget name, this is followed by some number of lines consistent of a part name and part quantity, followed by a blank line. The number of tokens (strings) can be used to distinguish between a widget's name, its composite parts or the end of the parts list. The parts file (part.txt) file) has one line for each part, specifying the part's name, its price and its quantity. The widgets.txt file contains information for each widget separated by blank lines [that means the last line of the file is also a blank line]. The first line contains the widget's name. The second and subsequent lines contain the part names (a string for a name) and part quantity (positive non-zero integer). You may assume all the data is correct and there are no errors possible in the your program's calculations (so don't worry about Exceptions for this assignment)!

/r/learnpython Thread