goods.java

来自「一个基于java工厂模式的 的实现」· Java 代码 · 共 103 行

JAVA
103
字号
/*
 * Good.java
 *
 * Created on 2007年4月20日, 下午3:11
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.ebuy.web.beans;

/**
 *
 * @author Administrator
 */
public class Goods
{
    private int productid;
    private String productname;
    private double unitprice;
    private double realprice;
    private int quantity;
    private double subtotal;
    
    public Goods()
    {
    }

    public int getProductid()
    {
        return productid;
    }

    public void setProductid(int productid)
    {
        this.productid = productid;
    }

    public String getProductname()
    {
        return productname;
    }

    public void setProductname(String productname)
    {
        this.productname = productname;
    }

    public double getUnitprice()
    {
        return unitprice;
    }

    public void setUnitprice(double unitprice)
    {
        this.unitprice = unitprice;
    }

    public double getRealprice()
    {
        return realprice;
    }

    public void setRealprice(double realprice)
    {
        this.realprice = realprice;
    }

    public int getQuantity()
    {
        return (quantity<100?quantity:99);
    }

    public void setQuantity(int quantity)
    {
        this.quantity = quantity;
    }

    public double getSubtotal()
    {
        return this.getRealprice()*this.getQuantity();
    }

    public void setSubtotal(double subtotal)
    {
        this.subtotal = subtotal;
    }
   
    public boolean equals(Object obj)
    {
        if(obj instanceof Goods)
        {
            Goods temp=(Goods)obj;
            if(temp.getProductid()==this.getProductid())
            {
                return true;
            }
        }
        return false;
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?