Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

Java/J2EE Forum
 

Open forum for discussing anything Java related. J2EE, JSPs, servlets, EJBs, JDBC, its all fair game and can be found in the Java/J2EE forum!


POST REPLY
Posted By: jayjay   5/9/2006 4:47:00 PM
 
Can someone help with this I have been trying and can't figure it out!

You are a manager at a small supermarket called “Acme Neighborhood Grocery”. Each week you perform an inventory of items on the shelf and in the storeroom. Your scanner records the product code from an item and you then count and record the number of items of that product code on-hand. This information is uploaded into a computer to create the inventory file, which is then sorted and used as input to process the weekly inventory reports.

Write a program that will sequentially process the Inventory file and create a report showing the inventory. You will use the product code to access the codes table to get the description and the price so you can calculate the total value for each item and for the entire inventory.


Input:

File of inventory codes:

File name: Codes
Field Description Positions Data Type Decimals
Product Code 1-6 Numeric 0
Product Description 7-46 Character
Price 47-50 Numeric 2

Product codes beginning in 100 are canned goods
Product codes beginning in 200 are frozen goods
Product codes beginning in 300 are packaged goods

Create sample input file consisting of 25 records, distributed among the three categories of product codes. The file is sorted alphabetically in ascending order.

Example: 100015,12oz. Campbell soup – Tomato,0089
300167,48oz. Pillsbury white flour,0249

The Codes file will be read into an array for reference during processing of the Inventory file


Inventory file:

File Name: Inventory
Field Description Positions Data Type Decimals
Product Code 1-6 Numeric 0
Number On-hand 7-10 Numeric 0


Create a sample input file consisting of 25 records. This file is sorted alphabetically in ascending order.

Example: 100053,065
200199,246


This file will be processed to create the output reports.
Output:

An inventory report will be produced from the processing. Each page will have a title displaying the name of the store, title of the report, and the date. The second title line will have the category of the inventory (canned goods, etc.) After three blank lines will be the column descriptions. The report will display the product code, description, price, quantity on-hand, and total value of the product on-hand. Each page will consist of a maximum of 40 lines. The report will break on product category (first three positions of the product code), with a new product category starting a new page. After all the records for a category have been processed, the total value of the category will be printed two lines below the last record for that category and in the same column as the item values.

When all records from the inventory file have been processed, there will be two blank lines and then the total inventory value.

Any time that the quantity on-hand for any item is less than 25, an asterisk will be printed to the right of the item line on the report. If the quantity is less than 10, two asterisks will be printed to the right of the item line on the report.

If for some reason there is not a match of the product code in the inventory file to the product code in the code table, an error message should be printed in the description area of the item line on the report.




 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005