QUOTE(ayman_mastermind @ 3 Jul, 2009 - 08:03 AM)

You have all those mentioned items in one array? I mean you cant have in the same array values of different types, such String(A12 and math), then price(double) and finally quantity(int). Maybe you mean an array for item numbers, an array for description, an array of prices etc... were the values at each index are respective to each other.
Furthermore to change the value of the item that has been stored in array for example the array is called items[]. let's say you want to replace the value of item number one that is at index 0 , simply what you do is the following:
CODE
items[0] = A14; // the previous value was A12,
This way the value is replaced directly...
If you want to replace the new value and store the old one you will have to store the old one into a new array(lets call it old[]) then we have:
CODE
old[0] = items[0]; // stores the old value in another array A12
items[0] = A14; // gives a new value to the item which is A14 instead of A12
I hope that was what you are looking for, hope this helps, good luck

by the way,i m using a class file to test the program
for example,inside my class file
i declared the array is Item[] itemArray = new Item[10];
the following is my class file:
public class Item {
private String itemNumber;
private String itemDescription;
private double sellPrice;
private int quantityOnhand;
Item() {
}
public Item(String code, String descript, double price, int quantity){
itemNumber = code;
itemDescription = descript;
sellPrice = price;
quantityOnhand = quantity;
}
public void setItemNumber(String code){
itemNumber = code;
}
public void setItemDescription(String descript){
itemDescription = descript;
}
public void setSellPrice(double price){
sellPrice = price;
}
public void setQuantityOnhand(int quantity){
quantityOnhand = quantity;
}
public String getItemNumber(){
return itemNumber;
}
public String getItemDescription(){
return itemDescription;
}
public double getsellPrice(){
return sellPrice;
}
public int getQuantityOnhand(){
return quantityOnhand;
}
}
somemore,the question is following below:
(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.
(

Write a driver program / main method to test the various
operations of the class Item.
Create an application program that declares an array of 100 components 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 items detail per line, with line numbering.
furthermore,can you help me to interpret it?
i m quite confused about the question..
This post has been edited by crazygrandpa: 3 Jul, 2009 - 10:15 AM