大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
酒店类
成都创新互联公司长期为上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为陇西企业提供专业的成都网站建设、成都网站制作,陇西网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。
package fdsa;
public class Hotel {
private String hotelID;
private String hotelName;
private String hoteladdess;
public String getHotelID() {
return hotelID;
}
public void setHotelID(String hotelID) {
this.hotelID = hotelID;
}
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}
public String getHoteladdess() {
return hoteladdess;
}
public void setHoteladdess(String hoteladdess) {
this.hoteladdess = hoteladdess;
}
public String getHotelPhone() {
return hotelPhone;
}
public void setHotelPhone(String hotelPhone) {
this.hotelPhone = hotelPhone;
}
private String hotelPhone;
}
客户类
public class Client{
private String clientName;
private String clientID;
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getClientID() {
return clientID;
}
public void setClientID(String clientID) {
this.clientID = clientID;
}
}
房间类
public class Room{
private String roomID;
private Hotel hotelID;
public String getRoomID() {
return roomID;
}
public void setRoomID(String roomID) {
this.roomID = roomID;
}
public Hotel getHotelID() {
return hotelID;
}
public void setHotelID(Hotel hotelID) {
this.hotelID = hotelID;
}
public String getRoomAmount() {
return roomAmount;
}
public void setRoomAmount(String roomAmount) {
this.roomAmount = roomAmount;
}
private String roomAmount;
}
这个后台程序里已经帮你设计好了的,至于怎么编程,达到前端的预设效果和功能,也不是这说的清的啊。
找个简单的:
import java.util.Scanner;
public class a1{
public static void main(String[] args){
Scanner s = new Scanner(System.in);//接受客户键盘输入,在命令行中,回车结束
System.out.println( "酒店管理系统" );
Hotel h = new Hotel();
System.out.println( h );
h.print();
while (true){
System.out.println( "请输入房间编号" );
//声明变量,用于接受控制台输入数据
String no = s.next();
//预订房间
h.order(no);
h.print();
}
}
}
class Room{
//房间号
private String no;
//房间类型
private String type;
//是否被占用
private boolean isUse;
public Room(){//默认调用
super();
}
public Room(String no,String type,boolean isUse){
super();
this.no = no;
this.type = type;
this.isUse = isUse;
}
public String getNo(){
return no;
}
public void setNo(String no){
this.no = no;
}
public String getType(){
return type;
}
public void setType(String type){
this.type = type;
}
public boolean isUse(){
return isUse;
}
public void setUse(boolean isUse){
this.isUse = isUse;
}
public String toString(){ //声明输出结果格式
return "[" + no + "," + type + "," + (isUse?"占用":"空闲") + "]";
}
}
class Hotel{
Room rooms[][];
public Hotel(){
rooms = new Room[5][4];//旅馆有五层,每层四个房间
for(int i=0; i rooms.length; ++i){//外层for循环是循环层,内存循环是循环的每层的房间
for(int j=0; j rooms[i].length; ++j){
if (i == 0 || i == 1) {
//后面加个空字符串,是自动数据类型转换,这样前面的数字会自动变成数字型字符串;
rooms[i][j] = new Room((i+1)*100+j+1 +"" , "标准间",false);
}
if (i == 2 || i == 3) {
rooms[i][j] = new Room((i+1)*100+j+1 +"" , "双人间",false);
}
if (i == 4) {
rooms[i][j] = new Room((i+1)*100+j+1 +"" , "豪华间",false);
}
}
}
}
//对外提供房间列表的打印方式
public void print(){
for(int i=0; i rooms.length; ++i){
for(int j=0; j rooms[i].length; ++j){
System.out.print( rooms[i][j] + " " );
}
//换行
System.out.println( );
}
}
//提供旅馆对外预定方式
public void order(String no){
for(int i=0; i rooms.length; ++i){
for(int j=0; j rooms[i].length; ++j){
if (rooms[i][j].getNo().equals(no)) {
//把对象的成员数据封装,通过成员方法访问
//1 成员变量的访问方式rooms[i][j].no;
//2 成员方法的访问方式
rooms[i][j].setUse(true);
return;
}
}
}
}
}
带数据库的就算了