CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Interfaces

Interfaces
Application
ProductTextFile class

The code for the ProductTextFile class

public class ProductTextFile implements ProductDAO
{
    public ProductTextFile()
    {
        // code that initializes fields
    }

    //*************************************************
    // Implement the ProductReader interface
    //*************************************************
    public Product getProduct(String code)
    {
        // code that returns a Product
    }

    public String getProductsString()
    {
        // code that returns a String that lists all products

        // this code can use the CODE_SIZE and DESCRIPTION_SIZE
        // constants from the ProductConstants interface
        // to align the product data
    }

    //*************************************************
    // Implement the ProductWriter interface
    //**************************************************
    public boolean addProduct(Product p)
    {
        // code that adds a Product
    }

    public boolean deleteProduct(Product p)
    {
        // code that deletes a Product
    }

    public boolean updateProduct(Product p)
    {
        // code that updates a Product
    }
}
Previous | Class diagram | Console | DAOFactory class | ProductTextFile class | ProductMaintApp class | Next