Task 1
(a) Define the class Item to store the details of an item sold
in the bookshop. Each object of Item should store the
following information:
· Item number
· Item description
· Selling price
· Quantity on hand
Besides the set and get methods, Item class should
also include:
· A no-argument constructor
· A constructor with parameters
· The method equals that returns true if two objects
contain the same information.
(b) Write a test driver to test the various operations of the
class Item.
Task 2
Create an application program that declares an array of 100
elements of type Item. Your program should provide the
following operations which the user may invoke from a menu:
· Add a new item into the array (duplicate entries are not
allowed).
· Amend the details of an item.
· Search for an item by item number.
· Enter a sales transaction (the quantity on hand has to
be reduced accordingly).
· Input stock received (the quantity on hand has to be
updated accordingly).
· List details of all items – one item’s detail per line, with
line numbering.
红字是我要问的,请帮忙,谢谢。
[ 本帖最后由 derrick90 于 2009-7-4 11:09 AM 编辑 ]




