Library - import java.util.Arrays; import java.util.Date;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Arrays; import java.util.Date; public class Library { Customer[] customers; Product[] products; int numCustomers = 0; int numProducts = 0; public Customer[] getCustomers() { return customers; } public Product[] getProducts() { return products; } public int getNumCustomers() { return numCustomers; } public int getNumProducts() { return numProducts; } public Library(int numC, int numP) { customers = new Customer[numC]; products = new Product[numP]; } public boolean addNewCustomer(String ssn, String name) { if(numCustomers < customers.length) { for(int i = 0; i < numCustomers; i++){ if(customers[i].getSSN().equals(ssn)) return false; } customers[numCustomers] = new Customer(numCustomers,ssn, name); numCustomers++; return true; } return false; } //complete the following methods public boolean addNewProduct(String title, String publisher, String author, String isbn, int edition) { if (numProducts< products.length) { Book book = new Book(title, publisher, author, isbn, edition); products[numProducts] = book; numProducts++; return true; } return false; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Page1 / 5

Library - import java.util.Arrays; import java.util.Date;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online