import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
public class ListTest {
public List homeToSelect;
public List ConsumerMessageToSelect;
public ListTest(){
this.homeToSelect=new ArrayList();
this.ConsumerMessageToSelect=new ArrayList();
}
//添加房间
public void Add(){
Home[] h={new Home("A001", "总统套间", 9999),
new Home("A000", "豪华总统套间", 19990),
new Home("C001", "标准双人间", 800, 80),
new Home("C002", "单人间", 300, 50),
new Home("C003", "单人间", 300, 50),
new Home("C004", "标准双人间", 800, 90),
};
homeToSelect.addAll(0,Arrays.asList(h));
Home h1=(Home) homeToSelect.get(0);
Home h2=(Home) homeToSelect.get(1);
Home h3=(Home) homeToSelect.get(2);
Home h4=(Home) homeToSelect.get(3);
Home h5=(Home) homeToSelect.get(4);
System.out.println("房间编号"+"\t"+"房间套餐"+"\t"+"天(/:元)"+"\t"+"小时(/:元)");
System.out.println(h1.num+"\t"+h1.Package+"\t"+h1.day);
System.out.println(h2.num+"\t"+h2.Package+"\t"+h2.day);
System.out.println(h3.num+"\t"+h3.Package+"\t"+h3.day+"\t"+h3.hour);
System.out.println(h4.num+"\t"+h4.Package+"\t"+h4.day+"\t"+h4.hour);
System.out.println(h5.num+"\t"+h5.Package+"\t"+h5.day+"\t"+h5.hour);
}
public void ChooseHome(){
Scanner s=new Scanner(System.in);
System.out.print("请输入房间编号:");
String x=s.next();
//String input=null;
for(Object h:homeToSelect){
Home w=(Home) h;
if(w.num.equals(x)){
System.out.println("房间信息:"+w.Package+":"+w.day+":"+w.hour);
way(w);
//homeToSelect.remove(w);
break;
}
}
}
public void way(Home z){
System.out.println("请选择入住时间类型:1-按天结算 2-按小时结算");
//System.out.println("房间:"+hr.num+"\t"+hr.Package+"\t"+hr.day+"\t"+hr.hour);
Scanner s=new Scanner(System.in);
int t=s.nextInt();
if(t==1){
System.out.println("请输入你的入住天数:");
int d=s.nextInt();
System.out.println("尊敬的顾客,你共需消费"+d*z.day+"元!");
}else if(t==2)
{
System.out.println("请输入你的入住时间:");
int d=s.nextInt();
System.out.println("尊敬的顾客,你共需消费"+d*z.hour+"元!");
}else{
System.out.println("你是智障吗?");
this.way(z);
}
}
public static void main(String[] args) {
ListTest l=new ListTest();
while(true){
Scanner s=new Scanner(System.in);
System.out.println("请输入客户信息:");
System.out.print("客户id:");
String id=s.next();
System.out.print("客户姓名:");
String name=s.next();
Consumer c=new Consumer();
c.id=id;
c.name=name;
System.out.println("有如下房间待选:");
l.Add();
l.ChooseHome();
}
}
}
添加回答
举报
0/150
提交
取消