Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Hotel;
- import java.util.Arrays;
- /**
- * Created by Ricsko on 2017. 02. 27..
- * egy hotel - komplexum létrehozáa volt a célom, ami minden igényt kielégít :)
- * gyerek nem foglalthat maga szobát, feltétlen kell neki szülő, ha többen érkeznek mint a 3 fős szoba akkor a gyerenek legalább kell 1 felnött a szobába mellete
- *
- */
- public class HotelType {
- private boolean itsclean = true; // tiszta-e a szoba
- private int[] numberofpeople = new int[3]; //3 fös egy szoba
- private int daysinhotel; //hány napot töltenek a szállodában
- private boolean dinner = false; //kér-e vacsit
- private int adults; //személyek száma
- private int children; //50% kedvezmény a gyerekre
- private boolean available;
- private RoomPriceType typeofroom;
- private int finalprize;
- final static int DINNERPLACES = 100;
- final static int DINNERPRICE = 5000;
- final static int NUMBEROFROOM = 150;
- public HotelType( int daysinhotel, boolean dinner, int adults, int children, RoomPriceType typeofroom) {
- this.daysinhotel = daysinhotel;
- this.dinner = dinner;
- this.adults = adults;
- this.children = children;
- this.typeofroom = typeofroom;
- !!!! ->>> ezt a részt nem lehetne egyszerűsíteni?
- switch (typeofroom){
- case ONESTAR: finalprize = 10000*adults*daysinhotel;
- case TWOSTAR: finalprize = 20000*adults*daysinhotel;
- case THREESTAR: finalprize = 30000*adults*daysinhotel;
- for (int i = 0; i < numberofpeople.length; i++) {
- numberofpeople[i] += 1;
- if (children>numberofpeople.length){
- System.out.println("Need another room");
- available=false;
- }
- }
- default: available=false;
- System.out.println("haventgotthisstar");
- }
- }
- public HotelType(int[] numberofpeople, int daysinhotel, int adults, RoomPriceType typeofroom) {
- this.numberofpeople = numberofpeople;
- this.daysinhotel = daysinhotel;
- this.adults = adults;
- this.children = 0;
- this.typeofroom = typeofroom;
- }
- public boolean needDinner(int adults){
- }
- public boolean moreGuest(){
- }
- public
- @Override
- public String toString() {
- return "HotelType{" +
- "itsclean=" + itsclean +
- ", numberofpeople=" + Arrays.toString(numberofpeople) +
- ", daysinhotel=" + daysinhotel +
- ", dinner=" + dinner +
- ", adults=" + adults +
- ", children=" + children +
- ", available=" + available +
- ", typeofroom=" + typeofroom +
- ", finalprize=" + finalprize +
- '}';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement