python project 3 1

ITSE-1429 Project Three, Inventory Report

This Programming Project allows you to demonstrate your basic knowledge of Object-Oriented Programming and the use of text file input and output. You will use information read from one text file to create instances of a class named InventoryItem. Next, you will read information from a second text file to update information about the quantities of these inventory items. Finally, you will use the information in the list of InventoryItem objects you created and updated to prepare a report that is written to an output file showing the inventory quantities and their total values as well as the overall total value of all these inventory items.

Start by designing a class called InventoryItem. This class contains the following private data attributes:

  • item_number, a unique number used to identify each item
  • description, the text description of the item
  • quantity, the number of items in the inventory
  • unit_cost, the value of a single unit of this item in dollars and cents

The InventoryItem class has the following methods:

  • An initialization method (__init__) that can be used to create an instance of the InventoryItem class. All the data attributes must be specified as arguments. This method guards against initializing the quantity to a negative number.
  • A __str__ method that returns a string displaying the object’s state.
  • A receive_items method that accepts as an argument the quantity of the item to be added to any existing quantity.
  • A ship_items method that attempts to reduce the quantity of the item. This method must not reduce the quantity of an item below zero. If an argument is passed to this method that would reduce the quantity below zero, a warning message will be displayed instead.
  • A set_quantity method that accepts as an argument a new quantity value for the inventory item. This method must also guard against setting the quantity to a value that is less than zero.
  • A get_item_number method that returns the value of the item_number.
  • A get_description method that returns the value of the description.
  • A get_quantity method that returns the value of the quantity.
  • A get_unit_cost method that returns the value of the unit_cost.

Place the class definition for InventoryItem in a separate file named “” and then include an “import inventoryitem” statement in your program to gain access to the class definition.

Your Python program will read and process two input files and create a single output file in addition to limited console output. Your program will read the contents of a file named “items.txt” and use a portion of the contents to initially create and define the inventory item objects.

The “items.txt” text file contains the definition of several inventory items. Each record in this file holds the following information in this order:

  • item_number
  • description
  • quantity
  • unit_cost

The fields in this file are comma-separated. That is, each field is separated from the next field by a comma. Example records for this file look like this:

12345,Ballpeen Hammer,25,18.75
56789,Phillips Screwdriver,120,10.95
24680,Claw Hammer,35,15.98
13579,Box Wrench,48,20.35

Although this file contains definitions for all the items in the company’s entire inventory, your program will only process the subset of records where the value of the item_number is in the range from 20000 to 79999.

After creating instances of the InventoryItem class, display a line on the console (screen) reporting how many inventory items were created. Your program will then read and process a file named “activity.txt”. The “activity.txt” text file contains transactions that will potentially change the quantities of individual inventory items. These are the codes used for the possible transactions:

  • “D” Define the quantity of an inventory item
  • “R” Receive an additional quantity of an inventory item
  • “S” Ship a quantity of an inventory item

Records within the “activity.txt” text file contain the following comma-separated fields:

  • Transaction code (“D”, “R”, or “S”)
  • item_number
  • quantity

Example records for the “activity.txt” file look like this:


Process only records in the “activity.txt” file that effect items you defined earlier (using the “items.txt” file) AND contain a valid transaction code (“D”, “R”, or “S”). Keep track of the total number of records processed as well as the number of records that were skipped either because they did not have a valid transaction code or they dealt with an inventory item that was not defined earlier (using the “items.txt” file).

After processing the entries in the “activity.txt” file your program can now display two items on the console (screen) using print statements. You will know and can display the total number of records processed as well as the number of records skipped.

The final step in this programming project is to calculate and display the inventory value of each item as well as the grand total of all the inventory items. This information will be written to an output text file named “Report.txt”. The first line of your inventory report will contain your full name and a made-up name for the company such as “The Albatross Company, Ltd.” The second line in your inventory report will contain the phrase, “prepared on:” followed by the current date and time. (I know, go look it up on the Internet.) The third line will be blank. The fourth line in your report is where the heading information begins. Your inventory report will look as much like this as possible:

Joe E. Bagadonutz for the Albatross Company, Ltd.

Prepared On: Thursday, May 31, 2018 at 05:36:15


Inventory Item

NumberDescriptionQuantityUnit PriceValue


56789Phillips Screwdriver12010.951,314.00

24680Claw Hammer5515.98878.89

28967Hex Wrench7019.981,398.60

301271/4 inch Drill1634.89558.24

440213 inch Trowel3810.74408.12

290371 inch Paintbrush732.95215.35



Once the inventory report is complete, display the overall dollar worth of all items in the inventory on the screen.

For this assignment you will create and submit two (2) files. The first file is named “” and contains the class definition. The second file is the program you wrote to solve this problem. The second file will be named “”, where “X” and “Y” are your first and last initials.

Your assignment will be graded by your instructor using different files than the sample data files provided. Your instructor may run their own program to evaluate how well you designed the InventoryItem class. The instructor’s program will exercise all the methods in the InventoryItem class.

To receive full credit for this programming assignment, you must:

  • Submit two separate files:
    • One named “”, where “X” and “Y” are your first and last initials, and
    • A second file named “”, which contains the class definition.
  • Submit a program that executes correctly.

Grading Guideline:

  • Create a comment containing the student’s full name. (5 points)
  • Document the program with other meaningful comments. (5 points)
  • Correctly define all the private data attributes in the InventoryItem class. (5 points)
  • Correctly define the __init__ method in the InventoryItem class. (5 points)
  • Define a __str__ method that completely describes the object in the InventoryItem class. (5 points)
  • Correctly define all the methods in the InventoryItem class. (10 points)
  • Process only the requested entries from the “items.txt” file (5 points)
  • Correctly create the inventory items from the “items.txt”. (5 points)
  • Report the number of inventory items created on the screen. (5 points)
  • Correctly process the transactions in the “activity.txt” file (10 points)
  • Skip records in the “activity.txt” file that need skipping. (5 points)
  • Correctly report on the screen the total number of records processed from the “activity.txt” file as well as the number of records skipped. (5 points)
  • Create the “Report.txt” file with correct title and date and time. (10 points)
  • Calculate and display the individual inventory item values in the report file. (10 points)
  • Calculate and display the overall inventory value in the report file. (5 points)
  • Also, display on the screen the overall total inventory value. (5 points)
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.