JAVA写一个小型水果超市

初学java,还不太熟悉,技术有限,多多包涵,哈哈。水果超市 包括以下功能:1.添加水果2.显示水果3.根据编号查询水果4.删除水果5.添加购物车6.查看购物车7.根据编号修改水果0.退出下面是我的包及类的构造:代码展示:package com.gem.fruit.entity;public class Fruit {    private int fruitID;    private Stri...
摘要由CSDN通过智能技术生成

初学java,还不太熟悉,技术有限,多多包涵,哈哈。

水果超市 包括以下功能:

1.添加水果
2.显示水果
3.根据编号查询水果
4.删除水果
5.添加购物车
6.查看购物车
7.根据编号修改水果

0.退出

下面是我的包及类的构造:

代码展示:

package com.gem.fruit.entity;

public class Fruit {
    private int fruitID;
    private String name;
    private double price;
    private int count;
    private String address;
    public int getFruitID() {
        return fruitID;
    }
    public void setFruitID(int fruitID) {
        this.fruitID = fruitID;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public double getPrice() {
        return price;
    }
    public void setPrice(double price) {
        this.price = price;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public Fruit() {
        super();
        // TODO Auto-generated constructor stub
    }
    public Fruit(int fruitID, String name, double price, int count, String address) {
        super();
        this.fruitID = fruitID;
        this.name = name;
        this.price = price;
        this.count = count;
        this.address = address;
    }
    @Override
    public String toString() {
        return "Fruit [fruitID=" + fruitID + ", name=" + name + ", price=" + price + ", count=" + count + ", address="
                + address + "]";
    }
    
}

package com.gem.fruit.entity;

public class User {
    private int userId;
    private String userName;
    private String userPassword;
    
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }
    
    public User(int userId,String userName, String userPassword) {
        super();
        this.userId=userId;
        this.userName = userName;
        this.userPassword = userPassword;
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((userName == null) ? 0 : userName.hashCode());
        result = prime * result + ((userPassword == null) ? 0 : userPassword.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        User other = (User) obj;
        if (userName

  • 8
    点赞
  • 88
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值