谁能帮我写一个java 程序 要求如下
//要求:模仿酒店订房流程//流程//1、酒店类:需要有编号,名字和地址等属性//2、房间类:需要有房间号码,类型,酒店编号,金额等属性(类型指大床,双人,单人,商务等)...
//要求:模仿酒店订房流程
//流程
//1、酒店类:需要有编号,名字和地址等属性
//2、房间类:需要有房间号码,类型,酒店编号,金额等属性(类型指大床,双人,单人,商务等)
//3、客户类:需要有客户姓名,身份证等属性
//4、订房记录类:需要有房间编号,客户身份证,入住时间和退房时间等属性,
(先创建一个酒店,再创建一个房间,创建一个客户,创建订房记录,要求输出各个流程及信息)
//1、酒店类:需要有编号,名字和地址属性
//2、房间类:需要有房间号码,类型,酒店编号,金额属性(类型指大床,双人,单人)
//3、客户类:需要有客户姓名,身份证属性
//4、订房记录类:需要有房间编号,客户身份证,入住时间和退房时间属性,
(先创建一个酒店,再创建一个房间,创建一个客户,创建订房记录,要求输出各个流程及信息) 展开
//流程
//1、酒店类:需要有编号,名字和地址等属性
//2、房间类:需要有房间号码,类型,酒店编号,金额等属性(类型指大床,双人,单人,商务等)
//3、客户类:需要有客户姓名,身份证等属性
//4、订房记录类:需要有房间编号,客户身份证,入住时间和退房时间等属性,
(先创建一个酒店,再创建一个房间,创建一个客户,创建订房记录,要求输出各个流程及信息)
//1、酒店类:需要有编号,名字和地址属性
//2、房间类:需要有房间号码,类型,酒店编号,金额属性(类型指大床,双人,单人)
//3、客户类:需要有客户姓名,身份证属性
//4、订房记录类:需要有房间编号,客户身份证,入住时间和退房时间属性,
(先创建一个酒店,再创建一个房间,创建一个客户,创建订房记录,要求输出各个流程及信息) 展开
展开全部
包名可修改成你自己的
============================================
package wineshop;
//记录类测试类
public class TestTackeDown {
public static void main(String[] args) {
// 新建一个酒店
Wineshop wineshop = new Wineshop(36687, "天上人间大酒店", "河北腹地");
// 来了一个客户
Client client = new Client("奥巴马", "1109111202478296",
"2012/12/12 8:00", "没想过要退房");
// 客户来了新开一个房间
Room room = new Room(688, "总统套房->单人", wineshop.getId(), 8898);
// 订房记录
new TackeDown(wineshop, room, client);
}
}
// 酒店类
class Wineshop {
// 酒店编号
private int id;
// 酒店名字
private String name;
// 酒店地址
private String adress;
public Wineshop(int id, String name, String adress) {
this.id = id;
this.name = name;
this.adress = adress;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdress() {
return adress;
}
public void setAdress(String adress) {
this.adress = adress;
}
}
// 房间类
class Room {
// 房间号码
private int roomId;
// 房间类型
private String type;
// 酒店编号
private int wineshopNumber;
// 金额
private int price;
public Room(int roomId, String type, int wineshopNumber, int price) {
this.roomId = roomId;
this.type = type;
this.wineshopNumber = wineshopNumber;
this.price = price;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getWineshopNumber() {
return wineshopNumber;
}
public void setWineshopNumber(int wineshopNumber) {
this.wineshopNumber = wineshopNumber;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}
// 客户类
class Client {
// 客户姓名
private String name;
// 客户身份证号码
private String identityCard;
// 客户入住时间
private String intoroomtime;
// 客户退房时间
private String outroomtime;
public Client(String name, String identityCard, String intoroomtime,
String outroomtime) {
this.name = name;
this.identityCard = identityCard;
this.intoroomtime = intoroomtime;
this.outroomtime = outroomtime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIdentityCard() {
return identityCard;
}
public void setIdentityCard(String identityCard) {
this.identityCard = identityCard;
}
public String getIntoroomtime() {
return intoroomtime;
}
public void setIntoroomtime(String intoroomtime) {
this.intoroomtime = intoroomtime;
}
public String getOutroomtime() {
return outroomtime;
}
public void setOutroomtime(String outroomtime) {
this.outroomtime = outroomtime;
}
}
// 订房记录类
class TackeDown {
public TackeDown(Wineshop wineshop, Room room, Client client) {
// 打印酒店名字
System.out.println("酒店名字:" + wineshop.getName());
// 次房间的酒店编号
System.out.println("此房间的酒店编号:" + room.getWineshopNumber());
// 打印房间ID
System.out.println("房间ID:" + room.getRoomId());
// 打印房间类型
System.out.println("房间类型:" + room.getType());
// 打印酒店地址
System.out.println("酒店地址:" + wineshop.getAdress());
// 打印客户身份证号码
System.out.println("身份证号码:" + client.getIdentityCard());
// 打印订房者姓名
System.out.println("订房者姓名" + client.getName());
// 打印定房者入住时间
System.out.println("入住时间:" + client.getIntoroomtime());
// 打印订房者退房时间
System.out.println("退房时间:" + client.getOutroomtime());
}
}
==============================================================
运行结果:
-----------------------------------------
酒店名字:天上人间大酒店
此房间的酒店编号:36687
房间ID:688
房间类型:总统套房->单人
酒店地址:河北腹地
身份证号码:1109111202478296
订房者姓名奥巴马
入住时间:2012/12/12 8:00
退房时间:没想过要退房
============================================
package wineshop;
//记录类测试类
public class TestTackeDown {
public static void main(String[] args) {
// 新建一个酒店
Wineshop wineshop = new Wineshop(36687, "天上人间大酒店", "河北腹地");
// 来了一个客户
Client client = new Client("奥巴马", "1109111202478296",
"2012/12/12 8:00", "没想过要退房");
// 客户来了新开一个房间
Room room = new Room(688, "总统套房->单人", wineshop.getId(), 8898);
// 订房记录
new TackeDown(wineshop, room, client);
}
}
// 酒店类
class Wineshop {
// 酒店编号
private int id;
// 酒店名字
private String name;
// 酒店地址
private String adress;
public Wineshop(int id, String name, String adress) {
this.id = id;
this.name = name;
this.adress = adress;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdress() {
return adress;
}
public void setAdress(String adress) {
this.adress = adress;
}
}
// 房间类
class Room {
// 房间号码
private int roomId;
// 房间类型
private String type;
// 酒店编号
private int wineshopNumber;
// 金额
private int price;
public Room(int roomId, String type, int wineshopNumber, int price) {
this.roomId = roomId;
this.type = type;
this.wineshopNumber = wineshopNumber;
this.price = price;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getWineshopNumber() {
return wineshopNumber;
}
public void setWineshopNumber(int wineshopNumber) {
this.wineshopNumber = wineshopNumber;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}
// 客户类
class Client {
// 客户姓名
private String name;
// 客户身份证号码
private String identityCard;
// 客户入住时间
private String intoroomtime;
// 客户退房时间
private String outroomtime;
public Client(String name, String identityCard, String intoroomtime,
String outroomtime) {
this.name = name;
this.identityCard = identityCard;
this.intoroomtime = intoroomtime;
this.outroomtime = outroomtime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIdentityCard() {
return identityCard;
}
public void setIdentityCard(String identityCard) {
this.identityCard = identityCard;
}
public String getIntoroomtime() {
return intoroomtime;
}
public void setIntoroomtime(String intoroomtime) {
this.intoroomtime = intoroomtime;
}
public String getOutroomtime() {
return outroomtime;
}
public void setOutroomtime(String outroomtime) {
this.outroomtime = outroomtime;
}
}
// 订房记录类
class TackeDown {
public TackeDown(Wineshop wineshop, Room room, Client client) {
// 打印酒店名字
System.out.println("酒店名字:" + wineshop.getName());
// 次房间的酒店编号
System.out.println("此房间的酒店编号:" + room.getWineshopNumber());
// 打印房间ID
System.out.println("房间ID:" + room.getRoomId());
// 打印房间类型
System.out.println("房间类型:" + room.getType());
// 打印酒店地址
System.out.println("酒店地址:" + wineshop.getAdress());
// 打印客户身份证号码
System.out.println("身份证号码:" + client.getIdentityCard());
// 打印订房者姓名
System.out.println("订房者姓名" + client.getName());
// 打印定房者入住时间
System.out.println("入住时间:" + client.getIntoroomtime());
// 打印订房者退房时间
System.out.println("退房时间:" + client.getOutroomtime());
}
}
==============================================================
运行结果:
-----------------------------------------
酒店名字:天上人间大酒店
此房间的酒店编号:36687
房间ID:688
房间类型:总统套房->单人
酒店地址:河北腹地
身份证号码:1109111202478296
订房者姓名奥巴马
入住时间:2012/12/12 8:00
退房时间:没想过要退房
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询