Sun Feb 01, 2009 6:17 am
/**
Brent Krise
Project 2 Hotel.java
February 2, 2009
*/
public class Hotel{
//for reading from the console
public static final java.util.Scanner INPUT
= new java.util.Scanner(System.in);
//data members
int floors;
int roomsperfloor;
int rooms;
String name;
//field holding name and room number
private String[][] squares;
//constructor: brings in the #floors and #rooms per floor
Hotel(int floors, int roomsperfloor){
this.floors = floors;
this.roomsperfloor = roomsperfloor;
}
//constructor: brings in 3 floors and 10 rooms per floor
Hotel(){
this.floors = 3;
this.roomsperfloor = 10;
}
//method for checking guests in
public boolean checkIn(String name, int room){
}
//method for checking guests out
public void checkOut(int room){
}
//method for checking if the hotel is full or not
public boolean isFull(){
}
//method for exiting the program
public void quit(){
return;
}
//check if the hotel meets the requirements
public boolean valid(){
if(rooms < 1 || rooms > 99 || floors < 1 || floors > 10){
System.out.println("This hotel doesn't meet the standards");
return false;
}else{
return true;
}
}
//main method
public static void main(String[]args){
System.out.println("How many floors in the hotel?");
floors = INPUT.nextInt();
System.out.println("How many rooms per floor?");
roomsperfloor = INPUT.nextInt();
Hotel h = new Hotel();
while (valid){
System.out.println(" 1. For checking a guest in");
System.out.println(" 2. For checking a guest out");
System.out.println(" 3. To quit");
if (INPUT.nextInt() == 1 && !isFull()){
h.checkIn();
}else if(INPUT.nextInt() == 2){
h.checkOut();
}else{
h.quit();
}
}
}
}
Sun Feb 01, 2009 11:59 pm
Sun Jun 07, 2009 6:56 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.