需求:CRM客户关系管理系统
功能:客户信息管理,客户等级管理,客户关系管理
结构:客户信息(属性:客户姓名,年龄,性别,手机号码,家庭住址,消费金额,客户等级)
铜牌客户等级(属性:优惠次数,折扣,最高减免金额,全年服务次数)
银牌客户等级(属性:优惠次数,折扣,最高减免金额)
金牌客户等级(属性:优惠次数,折扣)
业务员(属性:业务员姓名,工号,电话,客户归属【客户数组】)
要求:1、设计客户信息类,客户信息按照封装要求设计get和set方法,并实现构造方法 (15分)
2、设计客户等级类,继承客户信息类,客户等级要求按照封装要求设计get和set 方法,并实现构造方法。(20分)
3、客户有购物功能,不同客户等级,购物时验证折扣后金额是否超过最高减免金额 和服务次数,银牌客户不验证服务次数,金牌客户无金额限制和次数限制(20 分)
4、设计业务员功能接口:
完成添加客户信息及客户等级功能,客户初始等级为铜牌客户;实现思路:初始 化客户信息时,赋予客户属于铜牌客户的信息(10分)
完成客户等级升级功能,消费金额超过100000元升级成为银牌客户,超 过1000000元升级成为金牌客户;实现思路:判断客户初始消费金额,属于哪 类客户等级(10分)
完成查询客户信息功能;输出客户信息(10分)
- 初始化客户“拓拔野”信息,“拓拔野”购物根据个人等级进行折扣和消费金额 累加,“拓拔野”一天之内购物了12次。实现思路:循环购物,累加消费金额。 (5分)
- 业务员“蚩尤”是业务达人,一天之内就拉来了8名客户,正在犯愁,怎么录入 客户信息。还想着录入完成之后向团队的所有人展示自己今天的成功,把他的客 户都展示给大家看看,炫耀一下。实现思路:循环实例化客户对象,存到客户归 属中,循环展示(5分)
- “蚩尤”的客户很给力,他在炫耀的时候,就开始疯狂购物,一会就产生了5名 银牌客户,3名金牌客户,领导要求“蚩尤”将客户信息分类上报。实现思路: 设计修改客户等级方法,在6的基础上调用,修改客户等级,判断属于哪个子类, 输出(5分)
package dome;
//客户类
public class Cust {
private String name;//姓名
private int age;//年龄
private boolean sex;//性别
private String phone;//手机号码
private String address;//家庭住址
private double money;//消费金额
private String type;//客户等级
public Cust() {}
public Cust(String name,int age,boolean sex,String phone,String address,double money,String type) {
this.name=name;
this.age=age;
this.sex=sex;
this.phone=phone;
this.address=address;
this.money=money;
this.type=type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public void buy(double money,int count) {
}
}
package dome;
//铜牌客户
public class Tong extends Cust{
private int yhCount;//优惠次数
private double zk;//折扣
private double maxMoney;//最高折扣金额
private int count;//服务次数
public Tong() {}
public Tong(String name,int age,boolean sex,String phone,String address,double money,String type,int yhCount,double zk,double maxMoney,int count) {
super(name, age, sex, phone, address, money, type);
this.yhCount=yhCount;
this.zk=zk;
this.maxMoney=maxMoney;
this.count=count;
}
public int getYhCount() {
return yhCount;
}
public void setYhCount(int yhCount) {
this.yhCount = yhCount;
}
public double getZk() {
return zk;
}
public void setZk(double zk) {
this.zk = zk;
}
public double getMaxMoney() {
return maxMoney;
}
public void setMaxMoney(double maxMoney) {
this.maxMoney = maxMoney;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public void buy(double money, int count) {
double a=money*zk;
if(a>maxMoney&&count>this.count)
System.out.println("超过限制,不能购买!!!");
else
System.out.println("购买成功!!!!");
}
}
package dome;
//银牌客户
public class Yin extends Cust{
private int yhCount;//优惠次数
private double zk;//折扣
private double maxMoney;//最高折扣金额
public Yin(){}
public Yin(String name,int age,boolean sex,String phone,String address,double money,String type,int yhCount,double zk,double maxMoney) {
super(name, age, sex, phone, address, money, type);
this.yhCount=yhCount;
this.zk=zk;
this.maxMoney=maxMoney;
}
public int getYhCount() {
return yhCount;
}
public void setYhCount(int yhCount) {
this.yhCount = yhCount;
}
public double getZk() {
return zk;
}
public void setZk(double zk) {
this.zk = zk;
}
public double getMaxMoney() {
return maxMoney;
}
public void setMaxMoney(double maxMoney) {
this.maxMoney = maxMoney;
}
@Override
public void buy(double money, int count) {
double a=money*zk;
if(a>maxMoney)
System.out.println("超过限制,不能购买!!!");
else
System.out.println("购买成功!!!!");
}
}
package dome;
//金牌客户
public class Jin extends Cust{
private int yhCount;//优惠次数
private double zk;//折扣
public Jin() {}
public Jin(String name,int age,boolean sex,String phone,String address,double money,String type,int yhCount,double zk) {
super(name, age, sex, phone, address, money, type);
this.yhCount=yhCount;
this.zk=zk;
}
public int getYhCount() {
return yhCount;
}
public void setYhCount(int yhCount) {
this.yhCount = yhCount;
}
public double getZk() {
return zk;
}
public void setZk(double zk) {
this.zk = zk;
}
@Override
public void buy(double money, int count) {
System.out.println("购买成功!!!!");
}
}
package dome;
public interface IYW {
/**
* 新增初始化客户
* @param name
* @param age
* @param sex
* @param phone
* @param address
* @param money
* @param type
*/
public void addCust(String name,int age,boolean sex,String phone,String address,double money,String type);
/**
* 升级客户
* @param name
* @param age
* @param sex
* @param phone
* @param address
* @param money
* @param type
*/
public Cust shengji(String name,int age,boolean sex,String phone,String address,double money,String type);
/**
* 显示客户信息
*/
public void showCust(String name, int age, boolean sex, String phone, String address, double money, String type);
}
package dome;
//业务员类
public class YW implements IYW{
private String name;
private String number;
private String phone;
private Cust[] cust;
public YW() {}
public YW(String name,String number,String phone,Cust[] cust) {
this.name=name;
this.number=number;
this.phone=phone;
this.cust=cust;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Cust[] getCust() {
return cust;
}
public void setCust(Cust[] cust) {
this.cust = cust;
}
@Override
public void addCust(String name, int age, boolean sex, String phone, String address, double money, String type) {
Cust c=new Cust(name, age, sex, phone, address, money, type);
c.setType("铜牌客户");
}
@Override
public Cust shengji(String name, int age, boolean sex, String phone, String address, double money, String type) {
Cust c=new Cust(name, age, sex, phone, address, money, type);
if(money>=1000000){
c.setType("金牌客户");
}else if(money>=100000) {
c.setType("银牌客户");
}else {
c.setType("铜牌客户");
}
return c;
}
@Override
public void showCust(String name, int age, boolean sex, String phone, String address, double money, String type) {
Cust c=new Cust(name, age, sex, phone, address, money, type);
if(money>100000){
c.setType("银牌客户");
}else if(money>1000000) {
c.setType("金牌客户");
}else {
c.setType("铜牌客户");
}
// switch ((int)money) {
// case 100000: {
// c.setType("银牌客户");
// break;
// }
// case 1000000:{
// c.setType("金牌客户");
// break;
// }
// default:
// c.setType("铜牌客户");
// }
// System.out.println("客户姓名:"+c.getName());
}
}
package dome;
public class TextCust {
public static void main(String[] args) {
// Cust c=new Tong("拓拔野", 20, true, "13111111111", "北京", 100, "铜牌客户",100,0.98,1000000,20);
// double a=0.0;
// for(int i=0;i<12;i++) {
// ((Tong)c).buy(c.getMoney()*((Tong)c).getZk(), i);
// a=c.getMoney()*((Tong)c).getZk()+a;
// c.setMoney(a);
// }
// System.out.println(c.getName()+c.getMoney());
YW y=new YW("蚩尤", "0001", "13222222222", null);
Cust[] cust=new Cust[8];
for(int i=0;i<3;i++) {
//Cust c=new Tong("拓拔野"+i, 20, true, "13111111111", "北京", 1000000, "铜牌客户",100,0.98,1000000,20);
Cust c=y.shengji("拓拔野"+i, 20, true, "13111111111", "北京", 100000, "铜牌客户");
cust[i]=c;
}
for(int i=3;i<8;i++) {
Cust c=y.shengji("拓拔野"+i, 20, true, "13111111111", "北京", 1000000, "铜牌客户");
cust[i]=c;
}
y.setCust(cust);
for (int i = 0; i < cust.length; i++) {
System.out.println(y.getCust()[i].getName());
System.out.println(y.getCust()[i].getMoney());
System.out.println(y.getCust()[i].getType());
System.out.println();
}
}
}