最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
退房信息的java代碼,退房信息的java代碼是什么

Java 求改一段小程序,不用GUI

package com;

成都地區(qū)優(yōu)秀IDC服務(wù)器托管提供商(成都創(chuàng)新互聯(lián)公司).為客戶提供專業(yè)的西信服務(wù)器托管,四川各地服務(wù)器托管,西信服務(wù)器托管、多線服務(wù)器托管.托管咨詢專線:18980820575

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Calendar;

import java.util.Date;

import java.util.List;

public class Customer

{

public enum Type{

University

}

private long customerId; //客戶ID

private String name; //客戶姓名

private String address; //客戶常用住址

private String telNo; //客戶手機(jī)號(hào)

private long bookDate; //預(yù)定日期毫秒數(shù)

private long checkInDate; //客戶入住日期毫秒數(shù)

private long checkOutDate; //客戶退房日期毫秒數(shù)

private Type type; //客戶類型

/** 檢查指定客戶是否是周末預(yù)定*/

public static final boolean checkWeekend(Customer c)

{

Calendar cal = Calendar.getInstance();

cal.setTimeInMillis(c.bookDate);

int x = cal.get(Calendar.WEDNESDAY);

return x == Calendar.SATURDAY || x == Calendar.SUNDAY;

}

/** 計(jì)算指定客戶賬單*/

public static final double calcBill(Customer c)

{

switch (c.type)

{

case University:

return calcDuration(c) * 100;

default:

return 0.0;

}

}

/** 計(jì)算住店天數(shù)*/

public static final int calcDuration(Customer c)

{

return Math.round((c.checkOutDate - c.checkInDate) / (float)(1000 * 60 * 60 * 24));

}

public static final void printQueryedCustomer(long customerId, ListCustomer cs)

{

for(Customer c : cs)

{

if(c.customerId == customerId)

{

System.out.println("name:" + c.name);

System.out.println("address:" + c.address);

System.out.println("telNo:" + c.telNo);

System.out.println("checkInDate:" + c.checkInDate);

System.out.println("checkOutDate:" + c.checkOutDate);

System.out.println("duration:" + calcDuration(c));

}

}

}

private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

private static final long fromDateString(String date)

{//將日期字符串轉(zhuǎn)換成毫秒數(shù)

try

{

return sdf.parse(date).getTime();

} catch (ParseException e)

{

e.printStackTrace();

return 0;

}

}

private static final String toDateString(long millsec)

{//將毫秒數(shù)轉(zhuǎn)換成日期字符串

return sdf.format(new Date(millsec));

}

public Customer(Type type)

{

customerId = System.currentTimeMillis(); //以對(duì)象創(chuàng)建時(shí)刻為對(duì)象唯一標(biāo)識(shí)

this.type = type;

}

public long getCustomerId()

{

return customerId;

}

public Type getType()

{

return type;

}

public String getName()

{

return name;

}

public void setName(String name)

{

this.name = name;

}

public String getAddress()

{

return address;

}

public void setAddress(String address)

{

this.address = address;

}

public String getTelNo()

{

return telNo;

}

public void setTelNo(String telNo)

{

this.telNo = telNo;

}

public String getBookDate()

{

return toDateString(bookDate);

}

/**

* @param bookDate 比如"2014-01-11 13:55"

*/

public void setBookDate(String bookDate)

{

this.bookDate = fromDateString(bookDate);

}

public String getCheckInDate()

{

return toDateString(checkInDate);

}

/**

* @param bookDate 比如"2014-01-11 13:55"

*/

public void setCheckInDate(String checkInDate)

{

this.checkInDate = fromDateString(checkInDate);

}

public String getCheckOutDate()

{

return toDateString(checkOutDate);

}

/**

* @param bookDate 比如"2014-01-11 13:55"

*/

public void setCheckOutDate(String checkOutDate)

{

this.checkOutDate = fromDateString(checkOutDate);

}

public static void main(String[] args)

{

ListCustomer list = new ArrayListCustomer();

Customer c1 = new Customer(Type.University);

c1.setName("張三");

c1.setAddress("xxx");

c1.setTelNo("000");

c1.setCheckInDate("2014-02-22 12:00");

c1.setCheckOutDate("2014-02-24 12:00");

list.add(c1);

long id = c1.getCustomerId();

Customer c2 = new Customer(Type.University);

c2.setName("李四");

c2.setAddress("PPP");

c2.setTelNo("333");

c2.setBookDate("2014-03-25 10:17");

list.add(c2);

long idx = c2.getCustomerId();

System.out.println("客戶" + idx + (checkWeekend(c2)?"是":"不是") + "周末預(yù)定");

System.out.println("#############################################");

printQueryedCustomer(id, list);

System.out.println("#############################################");

System.out.println("客戶" + id + "的賬單是" + calcBill(c1));

}

}

如何用java編寫比較完善的賓館管理系統(tǒng)

package room;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import com.njit.HelloHotel;

import com.wind.util.DbUtil;

import java.io.UnsupportedEncodingException;

import java.sql.*;

public class roomadd extends JFrame

{

private JTextField roomno,roomcost,roomstatus,roomtype;

//private JComboBox roomtype;

private JButton ok,cancel,return1,chakan;

private Container contain;

public roomadd()

{

super();

this.setSize(350,450);

this.setTitle("添加信息");

this.setLocationRelativeTo(getOwner()); //居中

//設(shè)置組件布局

Container contain=getContentPane();

contain.setLayout(new BoxLayout(contain,BoxLayout.Y_AXIS));

//添加組件

JPanel cont=new JPanel (new GridLayout(4,2));

//添加組件

/*cont.add(new JLabel("客房類型"));

roomtype=new JComboBox();

roomtype.addItem("單人間");

roomtype.addItem("雙人間");

roomtype.addItem("三人房");

roomtype.addItem("四人間");

cont.add(roomtype);*/

cont.add(new JLabel("客房號(hào)"));

roomno=new JTextField(10);

cont.add(roomno);

cont.add(new JLabel("房間類型"));

roomtype=new JTextField(10);

cont.add(roomtype);

cont.add(new JLabel("客房?jī)r(jià)格"));

roomcost=new JTextField(10);

cont.add(roomcost);

cont.add(new JLabel("客房狀態(tài)"));

roomstatus=new JTextField(10);

cont.add(roomstatus);

//按鈕

JPanel cont1=new JPanel(new FlowLayout());

ok=new JButton("添加");

cancel=new JButton("取消");

chakan=new JButton("查看");

return1=new JButton("返回");

cont1.add(ok);

cont1.add(cancel);

cont1.add(chakan);

cont1.add(return1);

contain.add(cont);

contain.add(cont1);

//注冊(cè)監(jiān)聽器

ok.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

//ok事件處理

DbUtil util = new DbUtil();

Connection con=null;

try {

con = (Connection) util.getCon();

} catch (Exception e2) {

e2.printStackTrace();

}

String sql="insert into room values(?,?,?,?)";

PreparedStatement pstmt = null;

try {

pstmt = (PreparedStatement)con.prepareStatement(sql);

} catch (SQLException e2) {

e2.printStackTrace();

}

try {

pstmt.setString(1,roomno.getText());

pstmt.setString(2,roomtype.getText());

pstmt.setString(3,roomcost.getText());

pstmt.setString(4,roomstatus.getText());

pstmt.executeUpdate();

} catch (SQLException e1) {

e1.printStackTrace();

}

JOptionPane.showMessageDialog(null, " 注冊(cè)成功!");

}

});

//查看添加的預(yù)訂信息

chakan.addActionListener(new ActionListener(){

private JTable table;

public void actionPerformed(ActionEvent e) {

if(e.getSource()==chakan){

Connection con = null;

ResultSet rs=null;

DbUtil util = new DbUtil();

String[][] a;

String[] name = { "", "", "", ""};

int row = 0;

try {

con = (Connection) util.getCon();

}

catch (Exception e1) {

e1.printStackTrace();

}

try {

String roomno = null;

rs=(ResultSet) util.sroom(con, roomno);

} catch (Exception e1) {

e1.printStackTrace();

}

try {

while(rs.next()){

row++;

}

a = new String[row + 1][4];

a[0][0] = " 客房號(hào)";

a[0][1] = " 客房類型";

a[0][2] = " 客房?jī)r(jià)格 ";

a[0][3] = " 客房狀態(tài)";

table = new JTable(a,name);

int i = 0;

String roomno = null;

rs=(ResultSet)util.sroom(con,roomno);

while (rs.next()) {

// 往表中填充查詢到的數(shù)據(jù)

i++;

int j = 0;

table.setValueAt(new String(rs.getString("roomno").getBytes("ISO-8859-1"),"GBK") + "", i, j);

table.setValueAt(new String(rs.getString("roomtype").getBytes("ISO-8859-1"),"GBK") + "", i, ++j);

table.setValueAt(new String(rs.getString("roomcost").getBytes("ISO-8859-1"),"GBK") + "", i, ++j);

table.setValueAt(new String(rs.getString("roomstatus").getBytes("ISO-8859-1"),"GBK") + "", i, ++j);

}

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (UnsupportedEncodingException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (Exception e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

JFrame b5=new JFrame("顧客預(yù)訂信息");

b5.setLayout(new BorderLayout());

b5.add(table);

b5.setBounds(200, 200, 500, 300);

b5.setVisible(true);

b5.setResizable(true);

b5.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

}

}

});

cancel.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

System.exit(0);

}

});

return1.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

HelloHotel hello=new HelloHotel();

hello.setVisible(true);

dispose();

}

});

pack();

}

public static void main(String[] args) {

roomadd w=new roomadd();

w.setVisible(true);

}

}

大概改改就可以是你的需要的了

誰能幫我寫一個(gè)java 程序 要求如下

包名可修改成你自己的

============================================

package wineshop;

//記錄類測(cè)試類

public class TestTackeDown {

public static void main(String[] args) {

// 新建一個(gè)酒店

Wineshop wineshop = new Wineshop(36687, "天上人間大酒店", "河北腹地");

// 來了一個(gè)客戶

Client client = new Client("奧巴馬", "1109111202478296",

"2012/12/12 8:00", "沒想過要退房");

// 客戶來了新開一個(gè)房間

Room room = new Room(688, "總統(tǒng)套房-單人", wineshop.getId(), 8898);

// 訂房記錄

new TackeDown(wineshop, room, client);

}

}

// 酒店類

class Wineshop {

// 酒店編號(hào)

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 {

// 房間號(hào)碼

private int roomId;

// 房間類型

private String type;

// 酒店編號(hào)

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;

// 客戶身份證號(hào)碼

private String identityCard;

// 客戶入住時(shí)間

private String intoroomtime;

// 客戶退房時(shí)間

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());

// 次房間的酒店編號(hào)

System.out.println("此房間的酒店編號(hào):" + room.getWineshopNumber());

// 打印房間ID

System.out.println("房間ID:" + room.getRoomId());

// 打印房間類型

System.out.println("房間類型:" + room.getType());

// 打印酒店地址

System.out.println("酒店地址:" + wineshop.getAdress());

// 打印客戶身份證號(hào)碼

System.out.println("身份證號(hào)碼:" + client.getIdentityCard());

// 打印訂房者姓名

System.out.println("訂房者姓名" + client.getName());

// 打印定房者入住時(shí)間

System.out.println("入住時(shí)間:" + client.getIntoroomtime());

// 打印訂房者退房時(shí)間

System.out.println("退房時(shí)間:" + client.getOutroomtime());

}

}

==============================================================

運(yùn)行結(jié)果:

-----------------------------------------

酒店名字:天上人間大酒店

此房間的酒店編號(hào):36687

房間ID:688

房間類型:總統(tǒng)套房-單人

酒店地址:河北腹地

身份證號(hào)碼:1109111202478296

訂房者姓名奧巴馬

入住時(shí)間:2012/12/12 8:00

退房時(shí)間:沒想過要退房

客房管理系統(tǒng),用java,sql

首先得確定一下你用b/s還是c/s

再確定選什么書吧,

很多的

求大神幫忙寫下這個(gè)java程序

import?java.util.Scanner;

public?class?T1?{

static?String?[][]?rooms?=?new?String[12][10];

static?{

for?(int?i=0;i12;i++)

for?(int?j=0;j10;j++)

rooms[i][j]?=?"EMPTY";

}

public?static?void?main(String?argv[])?{

System.out.println("XXX酒店管理程序加載完畢,請(qǐng)輸入指令:");

Scanner?sca?=?new?Scanner(System.in);

while?(true)?{

String?comm?=?sca.next();

if?(comm.equalsIgnoreCase("Search"))?{

search();

}?else?if?(comm.equalsIgnoreCase("in"))?{

System.out.println("輸入客人姓名:");

String?name?=?sca.next();

inRoom(name);

}?else?if?(comm.equalsIgnoreCase("out"))?{

System.out.println("輸入客人房間號(hào):");

int?room?=?sca.nextInt();

outRoom(room/100,?room%100);

}?else?if?(comm.equalsIgnoreCase("exit"))?{

System.out.println("退出程序");

break;

}?else?{

System.out.println("無效的命令,請(qǐng)重新輸入!");

}

}

sca.close();

}

private?static?void?outRoom(int?i,?int?j)?{

if?(i1?||?i12?||?j1?||?j10)?{

System.out.println("輸入錯(cuò)誤,請(qǐng)重新輸入");

}?else???{

if?(rooms[i-1][j-1].equalsIgnoreCase("empty"))?{

System.out.printf("%02d%02d?并沒有客人入住\n",?i,?j);

}?else?{

System.out.printf("OUT?%02d%02d:?%02d%02d房間退房,客人姓名:%s\n",?i,?j,?i,?j,?rooms[i-1][j-1]);

rooms[i-1][j-1]?=?"EMPTY";

return;

}

}

}

private?static?void?inRoom(String?name)?{

for?(int?i=0;i12;i++)?{

for?(int?j=0;j10;j++)?{

if?(rooms[i][j].equalsIgnoreCase("EMPTY"))?{

rooms[i][j]?=?name;

System.out.printf("IN??%02d%02d??%s??:??姓名為%s的客人入住%02d%02d房間\n",?i+1,?j+1,?name,?name,?i+1,?j+1);

return;

}

}

}

}

private?static?void?search()?{

System.out.println("入住房間信息:");

System.out.println("---------------------------");

for?(int?i=0;i12;i++)?{

for?(int?j=0;j10;j++)?{

if?(!rooms[i][j].equalsIgnoreCase("EMPTY"))?{

System.out.printf("ROOM?%02d%02d?客人:%s\n",?i+1,?j+1,?rooms[i][j]);

}

}

}

System.out.println("---------------------------");

}

}

java作業(yè)程序,急求

package test;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.util.HashMap;

import java.util.Map;

public class Test {

public static void main(String[] args) throws IOException{ ?

MapString, Room rooms =initRooms();

BufferedReader ctrl=new BufferedReader(new InputStreamReader(System.in));

getRoomState(rooms);

boolean exit = true;

while(exit){

println("");

print("菜單: ");

print(" 1:訂房");

print(" 2:退房");

print(" 3:查詢");

print(" 4:退出");

println("");

print(" 請(qǐng)輸入:");

String num =ctrl.readLine();

cls();

switch (num) {

??? ?case "1":

??? ??? ? print("房間號(hào):");

??? ??? ? String rid = ctrl.readLine();

??? ??? ? print("帳號(hào):");

??? ??? ? String user = ctrl.readLine();

??? ??? ? print("密碼:");

??? ??? ? String pwd = ctrl.readLine();

??? ??? ? print("住天數(shù):");

??? ??? ? String day = ctrl.readLine();

??? ??? ? Room r = rooms.get(rid);

??? ??? ? if(r==null){

??? ??? ??? ? println("沒有此房間");

??? ??? ? }else{

??? ??? ??? ? r.setDay(Integer.parseInt(day));

??? ??? ??? ? r.setName(user);

??? ??? ??? ? r.setPwd(pwd);

??? ??? ??? ? rooms.put(r.getrId(),r);

??? ??? ??? ? println("訂房成功!!");

??? ??? ??? ? getRoomState(rooms);

??? ??? ? }

??? ??? ?break;

??? ?case "2":

??? ??? ?print("帳號(hào):");

??? ??? ? String user2 = ctrl.readLine();

??? ??? ? print("密碼:");

??? ??? ? String pwd2 = ctrl.readLine();

??? ??? ? Room r2 =getRoowByUserAndPwd(rooms,user2,pwd2);

??? ??? ? if(r2==null){

??? ??? ??? ? println("你沒有訂房!!");

??? ??? ? }else{

??? ??? ??? ?r2.setName("");

??? ??? ??? ?r2.setPwd("");

??? ??? ??? ?r2.setDay(0);

??? ??? ??? ?rooms.put(r2.getrId(),r2);

??? ??? ??? ?println("退訂成功");

??? ??? ??? ?getRoomState(rooms);

??? ??? ? }

??? ??? ?break;

??? ?case "3":

??? ??? ? print("帳號(hào):");

??? ??? ? String user3 = ctrl.readLine();

??? ??? ? print("天數(shù):");

??? ??? ? String day3 = ctrl.readLine();

??? ??? ? Room r3 =getRoowByUserAndDay(rooms,user3,day3);

??? ??? ? if(r3==null){

??? ??? ??? ? println("你沒有訂房!!");

??? ??? ? }else{

??? ??? ??? ?println(r3.toString());

??? ??? ? }

??? ??? ?break;

??? ?case "4":exit = false ;break;

?}

getRoomState(rooms);

}

}

private static void getRoomState(MapString, Room rooms) {

println("房間情況:");

for (Room r : rooms.values()) {

?? println("房號(hào):"+r.getrId()+"=" + r.getPrice()+" 狀態(tài):"+r.isEmptyRoom());

}

}

private static Room getRoowByUserAndDay(MapString, Room rooms,String user,String day) {

for (Room r : rooms.values()) {

?? if(r.getName().equals(user) day.equals(r.getDay()+""))

??? ?? return r;

}

return null;

}

private static Room getRoowByUserAndPwd(MapString, Room rooms,String user,String pwd) {

for (Room r : rooms.values()) {

?? if(r.getName().equals(user) pwd.equals(r.getPwd()+""))

??? ?? return r;

}

return null;

}

/**

* 初始化房間

*/

private static MapString, Room initRooms() {

MapString, Room result = new HashMapString, Room();

result.put("8001", new Room("8001",100.0));

result.put("8002", new Room("8002",100.0));

result.put("8003", new Room("8003",100.0));

result.put("8004", new Room("8004",200.0));

result.put("8005", new Room("8005",200.0));

result.put("8006", new Room("8006",200.0));

result.put("8007", new Room("8007",300.0));

result.put("8008", new Room("8008",300.0));

result.put("8009", new Room("8009",300.0));

return result;

}

public static void cls() throws IOException{

Runtime.getRuntime().exec("clear");

}

public static void println(Object str){

System.out.println(str);

}

public static void print(Object str){

System.out.print(str);

}

}

class Room{

private String rId="";

private String name="";

private String pwd="";

private int day=0;

private double price=0.0;

public String isEmptyRoom(){

return this.name.equals("")?"空房間":"已出租";

}

public Room(String rId, double price) {

this.rId = rId;

this.price = price;

}

@Override

public String toString() {

return "房號(hào)=" + rId + ", 用戶=" + name + ", 天數(shù)=" + day

??? ?+ ", 租金=" + price + ", 總金額=" + (price*day);

}

public Room(String name, String pwd, int day) {

this.name = name;

this.pwd = pwd;

this.day = day;

}

public Room() {

}

public String getrId() {

return rId;

}

public void setrId(String rId) {

this.rId = rId;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getPwd() {

return pwd;

}

public void setPwd(String pwd) {

this.pwd = pwd;

}

public int getDay() {

return day;

}

public void setDay(int day) {

this.day = day;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

}

比較粗糙將就


名稱欄目:退房信息的java代碼,退房信息的java代碼是什么
標(biāo)題來源:http://fisionsoft.com.cn/article/hspcoh.html