public class Venue {
private String buildingName;
private int roomNumber;
private int numberOfSeats;
public Venue() {
}
public Venue(String buildingName, int roomNumber, int numberOfSeats) {
this.buildingName = buildingName;
this.roomNumber = roomNumber;
this.numberOfSeats = numberOfSeats;
}
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public int getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
}
public int getNumberOfSeats() {
return numberOfSeats;
}
public void setNumberOfSeats(int numberOfSeats) {
this.numberOfSeats = numberOfSeats;
}
@Override
public String toString() {
return "Venue [buildingName=" + buildingName + ", roomNumber=" + roomNumber + ", numberOfSeats=" + numberOfSeats
+ "]";
}
public Venue createVenue() {
Venue venue = new Venue();
venue.setBuildingName(buildingName);
venue.setRoomNumber(roomNumber);
venue.setNumberOfSeats(numberOfSeats);
return venue;
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Menu {
public static void main(String[] args) {
int option = 0;
String nameOfRoom = " ";
int roomNumber = 0;
int numberOfSeats = 0;
List<Venue> hotel = new ArrayList<Venue>();
Scanner scan = new Scanner(System.in);
Scanner input = new Scanner(System.in);
do {
System.out.println("1: Add room ");
System.out.println("2: Display rooms");
System.out.println("3: Display problem labs");
System.out.println("4: Exit");
System.out.println("Do your choise: ");
option = scan.nextInt();
System.out.println("You choose: " + menus(option));
if (option == 1) {
System.out.println("Please provide name of room and press Enter: ");
nameOfRoom = input.nextLine();
System.out.println("Please provide room number and press Enter: ");
roomNumber = scan.nextInt();
System.out.println("Please provide number of seats and press Enter: ");
numberOfSeats = scan.nextInt();
Venue venue = new Venue(nameOfRoom, roomNumber, numberOfSeats);
System.out.println(venue.createVenue());
hotel.add(venue);
} else if (option == 2) {
for (Venue v : hotel) {
System.out.println(v.toString());
}
} else if (option == 3) {
System.out.println("Problem labs is no room is avaliable!");
}else if (option == 4) {
System.out.println("Quit..");
}
} while (option != 4);
scan.close();
input.close();
}
public static int menus(int option) {
return option;
}
}
Comments
Leave a comment