⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goods.java

📁 一个基于java工厂模式的 的实现
💻 JAVA
字号:
/*
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -