cake.add(cakeType[i]);
}
this.add(l);
this.add(l1);
this.add(cake);
this.add(l2);
this.add(水果);
this.add(巧克力);
this.add(l4);
this.add(vip);
this.add(儿童);
this.add(普通顾客);
this.add(l5);
this.add(l6);
this.add(l3);
this.add(t);
this.add(b1);
this.add(b2);
this.add(b3);
this.add(b4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
}
publicvoidfocusGained(FocusEvente){
}
publicvoidfocusLost(FocusEvente){
}
publicvoidkeyTyped(KeyEvente){
}
publicvoidkeyPressed(KeyEvente){
}
publicvoidkeyReleased(KeyEvente){
}
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==b1){
Stringa,s,s1,s2,s4;
a=cake.getSelectedItem();
s1=水果.getState()?
水果.getLabel():
"";
s2=巧克力.getState()?
巧克力.getLabel():
"";
s=discount.getSelectedCheckbox().getLabel();
if(a.equals("6.8寸的慕斯蛋糕(¥100)")){
Factorymusi=new幕斯cake工厂();
cakemusi1=musi.create("A");
if(s1.equals("水果(¥30)")&&s2.equals("")){
cakemusi2=new水果(musi1);
doublemoney=musi2.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
//Object[]options={"付款","取消"};
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}elseif(s1.equals("")&&s2.equals("巧克力(¥40)")){
cakemusi2=new巧克力(musi1);
doublemoney=musi2.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"购买成功"+"\n"+"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}elseif(s1.equals("水果(¥30)")&&s2.equals("巧克力(¥40)")){
cakemusi2=new水果(musi1);
cakemusi3=new巧克力(musi2);
doublemoney=musi3.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}elseif(s1.equals("")&&s2.equals("")){
cakemusi2=(musi1);
doublemoney=musi2.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}
}elseif(a.equals("10寸的慕斯蛋糕(¥150)")){
Factorymusi=new幕斯cake工厂();
cakemusi1=musi.create("B");
if(s1.equals("水果(¥30)")&&s2.equals("")){
cakemusi2=new水果(musi1);
doublemoney=musi2.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}elseif(s1.equals("")&&s2.equals("巧克力(¥40)")){
cakemusi2=new巧克力(musi1);
doublemoney=musi2.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿童折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money<200){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}elseif(s.equals("普通顾客")){
JOptionPane.showMessageDialog(null,"你的订单总金额为:
"+money+"元");
}
}elseif(s1.equals("水果(¥30)")&&s2.equals("巧克力(¥40)")){
cakemusi2=new水果(musi1);
cakemusi3=new巧克力(musi2);
doublemoney=musi3.cost();
if(s.equals("VIP")){
打折count=newvip();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"Vip折后价为:
"+money1+"元");
}elseif(s.equals("儿童")&&money>=200){
打折count=new儿童();
doublemoney1=money*count.打折price();
JOptionPane.showMessageDialog(null,
"你的订单总金额为:
"+money+"元"+"\n"+"儿