How do I print item facilities in another class?
I am creating a hotel booking system and I have come across a problem. Here is my main method:
Code :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ofi;
import java.util.Scanner;
/**
*
* @author a2-dunnage
*/
public class OFI {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Welcome to the Old Frenchay inn Booking System");
System.out.println("Please choose an option from the menu");
System.out.println("1: View Rooms");
System.out.println("2: Exit");
int num = scan.nextInt();
if (num == 1) {
System.out.println("1:Single, 2:Double, 3:Family");
}
System.out.println("Please select one of the following room types above");
num = scan.nextInt();
if(num == 1) {
System.out.println();
}
}
}
I want to be able to print the room facilities for each type of room I have. I have a SingleRoom, DoubleRoom and FamilyRoom class. Basically I want to be able to print the room facilities so when the customer chooses single room it will display the facilities for that room here is my SignleRoom class:
Code :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ofi;
/**
*
* @author a2-dunnage
*/
public class SingleRoom extends Room {
private int price;
private boolean enSuite;
private boolean internet;
private boolean miniBar;
private boolean tv;
private int roomNumber;
public SingleRoom(int price, boolean enSuite, boolean internet, boolean miniBar, boolean tv, int roomNumber) {
super(price, enSuite, internet, miniBar, tv, roomNumber);
this.price = price;
this.enSuite = enSuite;
this.internet = internet;
this.miniBar = miniBar;
this.tv = tv;
this.roomNumber = roomNumber;
}
public SingleRoom(int roomNumber){
super(30,true,true,true,false,roomNumber);
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public boolean isEnSuite() {
return enSuite;
}
public void setEnSuite(boolean enSuite) {
this.enSuite = enSuite;
}
public boolean isInternet() {
return internet;
}
public void setInternet(boolean internet) {
this.internet = internet;
}
public boolean isMiniBar() {
return miniBar;
}
public void setMiniBar(boolean miniBar) {
this.miniBar = miniBar;
}
public boolean isTv() {
return tv;
}
public void setTv(boolean tv) {
this.tv = tv;
}
public int getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
}
@Override
public String toString() {
return "SingleRoom{" + "price=" + price + ", enSuite=" + enSuite + ", internet=" + internet + ", miniBar=" + miniBar + ", tv=" + tv + ", roomNumber=" + roomNumber + '}';
}
}
How can I print from this class into my main method?