Week 10programming Concept Assignment.
Week 10programming Concept Assignment.
Your program is to read the product file and determine which items are to be
reordered. An item is to be reordered if it is not obsolete and if the quantity
of the item currently on hand, plus the amount on order, is less than its
minimum inventory level. Print a detail line for each item to be reordered,
listing the item number, quantity on hand, quantity on order and minimum
inventory level. Print headings and column headings at the top of each page,
allowing for 45 detail lines per page, and at the end of the report, the total
number of items to be reordered.
Solution:
A. Characterizing Diagram.
min_inv_level min_inv_level
obsolete_code total_reorder_items
B. Hierarchy chart.
Process_
inventory_
records
Line_count inventory record
line_count
Print_ Print_
page_ recorder_
headings record
C. Solution algorithm
Process_inventory_records
1 Set page_count, line_count, total_reorder_items to zero
2 Print_page_headings (line_count)
3 Read inventory record
4 DOWHILE more records
5 IF line_count >= 45 THEN
Print_page_headings (line_count)
ENDIF
6 IF obsolete_code = blank THEN
IF (qty_on_hand + qty_on_order) < min_inv_level THEN
Print_reorder_record (inventory record, line_count)
add 1 to total_reorder_items
ENDIF
ENDIF
7 Read inventory record
ENDDO
8 Print ’Total reorder items’, total_reorder_items
END
Print_page_headings (line_count )
9 add 1 to page_count
10 Print main heading
11 Print column headings
12 Print blank line
13 Set line_count to zero
END
Print_reorder_record (inventory record, line_count)
14 Print item_num, qty_on_hand, qty_on_order, min_inv_level
15 add 1 to line_count
END
D. Desk Checking
i. Input data:
First Record Second Record Third Record
item_num 1111 2222 EOF
qty_on_hand 10 40
qty_on_order 10 40
min_inv_level 30 30
obsolete_code Blank Blank
Q2.