Monday, February 9, 2009

/*Programmer:Miexie D. Tulid
*Title:Catalog class*/


public class Catalog
{
int x=0;
Shirt shirtobjects[]=new Shirt[3];

public Catalog(int id,double p,String c, String d, int q){
shirtobjects[id]=new Shirt(id,p,c,d,q);
}



public void addShirt(int id,double p,String c, String d, int q){

for(int y=0;y
if(shirtobjects[y].shirtID==id)
{q=shirtobjects[y].addStock(q);
shirtobjects[y]=new Shirt(id,p,c,d,q);
}
else{
shirtobjects[id]=new Shirt(id,p,c,d,q);

}}

}

public void removeShirt(int id,double p,String c, String d, int q){

for(int y=0;y if(shirtobjects[y].shirtID==id)
{q=shirtobjects[y].removeStock(q);
if(q==0){

shirtobjects[y]=new Shirt(0,0,"none","none",0);
}
else{
shirtobjects[y]=new Shirt(id,p,c,d,q);

}
}

}
}
public String generateString(int z){
return String.format(shirtobjects[z].displayInformation());
}


}

No comments:

Post a Comment