0% found this document useful (0 votes)
9 views

CSE101 Assignment 04

Uploaded by

berkc766
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CSE101 Assignment 04

Uploaded by

berkc766
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSE 101 Programming Assignment 4 Page 1 of 3

Due:
Friday, 23-December-2022 by 23:59

Deliverables:
The following Java files should be submitted to MS Teams by the due date and time
specified above. Submissions received after the deadline will be subject to the late
policy described in the syllabus.
o StoreUsingFiles_{StudentNumber}.java
Specifications:

Overview: You will continue the program this week to maintain the inventory for a store. Do
not forget your headers with @author and @since information. This program will be
expanded in CSE 102, so be sure you understand the concepts covered in this program.

Requirements: Write a program that will read files for both the inventory of a store and
the items requested by a customer. It will then write three files to show the results of
filling a customer’s order.

To facilitate the execution of this program, you will write (at minimum) the following
methods:
1. countProducts(filename)
a. A new method to determine how many items are in the store inventory
b. Takes String representing the filename as a parameter
c. Reads the file and counts the lines in the file
d. Returns an integer for the number of lines in the file
2. getProductInfo(itemID, itemName, quantity, price, filename)
a. A new method to fill the arrays with the inventory information
b. The file will be read and the values put into the arrays
c. The file will have the format of item ID, name, quantity, price separated
by spaces
d. It will take five parameters
i. String array for item IDs (a four character unique ID)
ii. String array for names of the items in stock
iii. Integer array for number of each item
iv. Decimal array for price of each item
v. String for the filename
e. Returns None

CSE 101|Fall 2022 1


CSE 101 Programming Assignment 4 Page 2 of 3

3. writeProductInfo(itemID, itemName, quantity, price, filename)


a. A new method to write an output file with updated inventory information
b. The file will have the format of item ID, name, quantity, price separated
by spaces
c. It will take five parameters
i. String array for item IDs (a four character unique ID)
ii. String array for names of the items in stock
iii. Integer array for number of each item
iv. Decimal array for price of each item
v. String for the filename
d. Returns None
4. main(args)
a. You will have a main method in this program
b. We will pass the base filename as the command line argument
c. It will
i. Read the inventory from a file called {base filename} +
“_ProductInfo.txt”
ii. Read the customer requests from a file called {base filename} +
“_Order.txt”
iii. Write the customer receipt to a file called {base filename} +
“_Receipt.txt”
iv. Write any errors to a file called {base filename} + “.log”
v. Write the resulting inventory to a file called {base filename} +
“_ProductInfoAfterOrder.txt”
d. Returns none
5. Any other methods you feel helpful can be implemented, however, these will be
the only methods tested.

Design:
When your main method is called, your program should display nothing. All interaction
with the program should be done through reading and writing files. Given the example
files below:

Code: Prior to running your program, only the following example files could be used as
input to the program:

If we run the program using the following command:

CSE 101|Fall 2022 2


CSE 101 Programming Assignment 4 Page 3 of 3

After running, the following files will be created:

Note: The original files will not be altered.

Test: You are responsible for testing your program. It is important to not rely solely on
the examples presented in this Project description.

Grading:
MS Teams Submission: If anything is ambiguous, it is your responsibility to ask questions. It
is also your responsibility to complete this assignment in a timely manner. E-mails with
questions regarding this assignment will likely not be answered if received after 17:00 on the
due date of the assignment. You can submit multiple times using MS Teams, however, we
will only grade the last version that you submitted.

Filename: You must name your java file according to the description above. If your file is not
named in this way, your submission for this assignment will not be accepted.

CSE 101|Fall 2022 3

You might also like