要求:做两个Web Service(一个hotel,还有一个是银行):一个旅馆(hotel)提供预留房间的系统,一个房间拥有房间号和房间内床的数量(比如:一张床,二张小床,二张大床);
.房间要有房间列表以及带有床的数量,
.如果有空房,得给出房间号用床的数量还有日期(哪天这个房间有空的意思)
。预留的话,得给出空房的信息外还得加上期限(多长时间)预留一个房间,顾客要提供一个卡号,旅馆收到这个卡号,然后问银行这个卡号是不是有效的
Web Service hotel:public listRoom();
public Roomfree(String c, int j, int m, int nbj);//j:日,  m:月, nbj:多少天
public reserveRoom(String c, int j, int m, int nbj, long ncb);
Web Service bank:public static int NUMEROVALIDE = 0;
public static int NUMERONONVALIDE = 1;
public int valider(long numeroCarte);还有个顾客:主要登录旅馆服务系统去预留房间。请大家帮下忙,知道怎么做这个吗?

解决方案 »

  1.   

    房间和卡号都用数据库表示就好了,
    关键在于以下方法有些不明白。因为房间的数据库里只有(房间号和床的数量)
    public Roomfree(String c, int j, int m, int nbj);//j:日, m:月, nbj:多少天
    public reserveRoom(String c, int j, int m, int nbj, long ncb);//ncb:房间数
    有谁能告诉我这两个方法怎么写吗?
    至于public list<Room> getRooms(){
                EntityManager em = getEntityManager();
                int nbre = ((Long) em.createQuery("select count(o) from Cd as o").getSingleResult()).intValue();            Query q = em.createQuery("select object(o) from Cd as o");
                q.setMaxResults(nbre);
                q.setFirstResult(0);
                return q.getResultList();
    };我这样写就应该没啥问题了
      

  2.   

    请大家给点意见,关于下面的方法:public Roomfree(String c, int j, int m, int nbj);//j:日, m:月, nbj:多少天
    public reserveRoom(String c, int j, int m, int nbj, long ncb);//ncb:房间数
    至于方法public listRoom();我已经写出来了,看上面我回复的贴子希望大家给点意见,帮下忙