Make your own free website on Tripod.com

Extra Credit 2

Start a new main program.  Call the class storetest2 save it as storetest2.java

Then declare an array of 3 stores.

Store ar[] = new Store[3];
ar[0] = new Store("Kmart");
ar[1] = new Store("Tops");
ar[2] = new Store("Caldors");

then write a fully functioning program that will let you enter store number and then perform a function.
All the member functions should be available via a menu selection.

It should all be wrapped in a do - while loop

Example

Enter Store Number 1

1.  to add to apples
2.  to add to pears
3  to add to oranges 
 -- -- --- 

15. End Program  (I don't know what your end number will be.
Please enter you choice  --

If they enter 15 (or whatever your number is ) the program will end. Otherwise the program 
will do what you selected. It may ask you for further information. For example if you select 1
it will ask you how many apples to add and then will call the appropriate member function
to add it the particular store whose number you selected above. Store numbers will be 0, 1 or 2.


One of the menu options should allow you to print out all the stores.