初学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