Tags:
tag this topic
create new tag
view all tags
---+ Inventory updates: Methods, files and command line arguments: Fall 2023 ---++ Learning Objective(s) 1 Learn to use command line arguments 1 Do more abstraction 1 See the need for a way to store a group of data in memory ---++ Overview of the Program Create a program the queries and updates inventory status. There is to be a file with the commands: * <b>=</b> means to display the item, how much is currently in stock and the level at which to reorder * <b>+</b> means to record the arrival of more inventory of a given item * <b>-</b> means to remove a certain amount for the inventory of a given item * <b>!</b> means to quit the program ---++ Specifics * The program should be called *Inventory* * There is to be no use of <b>System.in</b> in the final version. * All error messages are to go <b>System.err</b> * The only output to go to <b>System.out</b> should be the status of any given item specified with the <b>=</b> command. * All file IOExceptions should be caught (not thrown) * The file data will be coming from files specified at the command line. Samples of each file can be found in the lab folder. The order of the files is as follows: 1. The list of items in the inventory 1. The amount currently in stock of each item 1. The reorder level of each item 1. The list of commands to be processed 1. The temp file used when saving the results * There should be at least 9 constants. 5 for the position of each filename in the command line and 4 for each type of command * You should have one method that will process a single command. * A method to copy one file of integers (unchanged) to another file would be helpful. * A method to copy one file of integers (changing the integer on one specific line by adding another integer to it) to another file would be helpful. * One method that displays the status of an item would be helpful. * A method to retrieve an integer on a specific line in a file would be helpful (returning 0 on problems). * A method to return the line an item appears in a file would be helpful (returning -1 on problems) * The file that contains the commands is to be opened and closed only once and those tasks are to be done in the main method. * The opening and closing of any of the four files can only be done in a total of four different methods. (Suggestion: finding the location of an item, getting the n'th number in a file, copying a file (unchanged), and copying a file (changing one number) * if a method opens a file, it should close it before it returns ---++Sample dialogue The only output would be when displaying the status. You can see that output if you run the program in the lab folder See classroom instructions for more details. ---++Submission a. Create your SDR. * In *Lessons Learned*, include a discussion the level of abstraction (i.e. how generic each of your methods is). The fewer methods that explicitly reference the task (inventory control) the better (as long as it is achieved while still having quality variable and method names). * Your testing should include at least 2 different types of errors and ensure that every line of code is executed at least once. Add copies of your files that you used (with appropriate links back to the test cases) at the end of the report. Try to put them in columns to save space. You might want to have different sets of files for some of the different tests. * If you used any hints, be sure to indicate that in the *Outside Resources Used* section * For <b>Future Improvements</b> include a discussion about what tasks would the program need to accomplish to make this a complete inventory control system a. Convert your SDR into a pdf document a. Create an empty zip folder a. Place your java file and pdf document in it. a. Submit the zip folder on canvas ---++Hints 1 [[CSC121F2023Lab08Hint1][Algorithm hint to process a command]] 1 [[CSC121F2023Lab08Hint2][Hint to output to a file]] 1 [[CSC121F2023Lab08Hint3][Hint to copy a file (with and without changing]] 1 [[CSC121F2023Lab08Hint4][Abstraction hint]] ---++ Optional improvements Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor. * Also have the program create another file (on command) with the list of items to be reordered based on current inventory levels * Adapt the files so that the list of items, inventory level and control level are all in one file.
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r4 - 2023-06-22
-
cathybareiss
Home
Site map
Assessment web
BethelAIResources2026 web
CenterForComputing web
ChatGPT web
Intro2AIatBethel web
Main web
Sandbox web
TWiki web
CenterForComputing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback