{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

TechStore - this.name = name public void addProduct(Product...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class TechStore { private String name; private Product [] products; public TechStore() { name = ""; products = new Product[0]; } public TechStore (String name, Product[] productList) { this.name =name; products = new Product[productList.length]; for (int i = 0; i<productList.length; i++) { products[i]= productList[i]; } } public String getName() { return name; } public void setName( String name) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: this.name = name; } public void addProduct (Product p) { Products prod = new Product[products.length+1]; for (int i =0; i; i<products.length; i++) { products[i]=prod[i]; } prod[i] = p; products = prods; System.out.println("Added product successfully"); } public void removeProduct (Product p) { } public void sortByPrice() { } public void printInfo() { } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online