By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,654 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,654 IT Pros & Developers. It's quick & easy.

How can I do the checkIn and find room mothed ?

P: 1
Expand|Select|Wrap|Line Numbers
  1. public class Hotel {
  2.  
  3.     private Room[] rooms;    
  4.  
  5.  
  6.  
  7.     public Hotel() {
  8.         rooms = new Room[23];
  9.         int i = 0;
  10.         for(; i<5; i++) {
  11.             if (i%2==0) {
  12.                 rooms[i] = new Room(101+i, 2, "Queen", true, 150);
  13.             } else {
  14.                 rooms[i] = new Room(101+i, 1, "King", true, 135);
  15.             }
  16.         }
  17.         for(; i<20; i++) {
  18.             int number = (i/10+1)*100+1+i%10;
  19.             if (i%3==0) {
  20.                 rooms[i] = new Room(number, 1, "Queen", false, 100);
  21.             } else if (i%4==0) {
  22.                 rooms[i] = new Room(number, 1, "King", false, 125);
  23.             } else {
  24.                 rooms[i] = new Room(number, 2, "Double", false, 85);
  25.             }
  26.         }
  27.         for(; i<23; i++) {
  28.             rooms[i] = new Room(301+i%10, 4, "Queen", true, 500);
  29.         }
  30.     }
  31.     public void printRooms() {
  32.         for(int i=0; i<rooms.length; i++) {
  33.             System.out.println(rooms[i]);
  34.         }
  35.     }
  36.  
  37.  
  38.     public boolean checkIn(int room, String name, int guests, int nights) {
  39.  
  40.         // WRITE ME!
  41.  
  42.         return true;
  43.     }
  44.  
  45.  
  46.     private Room findRoom(int num) {
  47.  
  48.         // WRITE ME!
  49.  
  50.         return null;
  51.     }
  52.  
  53. }
Oct 12 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,421
This is not a code writing service and you have not explained anything about what you're trying to do. We can offer suggestions, ideas, or syntax fixes, but we are not here to do your work for you.
Oct 12 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.