Project Three, Inventory Report

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.

Don't use plagiarized sources. Get Your Custom Essay on
Project Three, Inventory Report
Just from $13/Page
Order Essay

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

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

The InventoryItem class has the following methods:

  • A constructor that can be used to create an instance of the InventoryItem class. All the fields must be specified as arguments. This method guards against initializing the quantity to a negative number.
  • A receiveItems method that accepts as an argument the quantity of the item to be added to any existing quantity. Guard against receiving a quantity that is less then or equal to zero.
  • A shipItems 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 of changing the quantity.
  • A setQuantity 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 getItemNumber method that returns the value of the itemNumber.
  • A getDescription method that returns the value of the description.
  • A getQuantity method that returns the value of the quantity.
  • A getUnitCost method that returns the value of the unitCost.

Place the class definition for InventoryItem in a separate file.

Design your solution so that it can handle up to 100 inventory items.

Your Java program will read and process two input text files and create a single output text file in addition to displaying limited output. Your program will read the contents of a file named “items.txt” and use a portion of the contents of this file 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 contains the following information in this order:

  1. itemNumber
  2. description
  3. quantity
  4. unitCost

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 itemNumber is in the range from 20000 to 79999.

After creating instances of the InventoryItem class, display a single line of output 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:

  1. transaction code (“D”, “R”, or “S”)
  2. itemNumber
  3. quantity

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

D,12345,0
R,12345,100
S,12345,45

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 created earlier (using the “items.txt” file).

After processing the entries in the “activity.txt” file your program can now display two items as output. You will know and can display the total number of records processed as well as the number of records skipped for any reason.

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

I N V E N T O R Y R E P O R T

Inventory Item

Number Description Quantity Unit Price Value

—— ——————– ——– ———- ————

56789 Phillips Screwdriver 120 10.95 1,314.00

24680 Claw Hammer 55 15.98 878.89

28967 Hex Wrench 70 19.98 1,398.60

30127 1/4 inch Drill 16 34.89 558.24

44021 3 inch Trowel 38 10.74 408.12

29037 1 inch Paintbrush 73 2.95 215.35

============

Total $4,773.21

Once the inventory report is complete, display the overall dollar worth of all the inventory items as a line of output.

For this assignment you will follow the procedures for packing, naming, and submitting Programming Project Assignments. The compressed file you submit will be named “XYProjectThree”, 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.

Test your program thoroughly before submitting it!

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

  • Submit a properly named compressed file:
  • 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 constructor method 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”. (10 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)

Test your program thoroughly before submitting it!

items.txt

12345,Ballpeen Hammer,25,18.75

56789,Phillips Screwdriver,120,10.95

24680,Claw Hammer,35,15.98

13579,Box Wrench,48,20.35

28967,Hex Wrench,70,19.98

90909,Wide Paintbrush,107,17.45

30127,1/4 inch Drill,16, 34.89

44021,3 inch Trowel, 38, 10.74

29037,1 inch Paintbrush, 73, 2.95

Activity.txt

D,12345,0

R,12345,100

S,12345,45

D,24680,0

R,24680,100

S,24680,45

X,24680,123

Still struggling to complete your homework?
Get instant homework help from our expert academic writers!