Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. package Hotel;
  2.  
  3. import java.util.Arrays;
  4.  
  5. /**
  6. * Created by Ricsko on 2017. 02. 27..
  7. * egy hotel - komplexum létrehozáa volt a célom, ami minden igényt kielégít :)
  8. * 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
  9. *
  10. */
  11. public class HotelType {
  12. private boolean itsclean = true; // tiszta-e a szoba
  13. private int[] numberofpeople = new int[3]; //3 fös egy szoba
  14. private int daysinhotel; //hány napot töltenek a szállodában
  15. private boolean dinner = false; //kér-e vacsit
  16. private int adults; //személyek száma
  17. private int children; //50% kedvezmény a gyerekre
  18. private boolean available;
  19. private RoomPriceType typeofroom;
  20. private int finalprize;
  21.  
  22. final static int DINNERPLACES = 100;
  23. final static int DINNERPRICE = 5000;
  24. final static int NUMBEROFROOM = 150;
  25.  
  26. public HotelType( int daysinhotel, boolean dinner, int adults, int children, RoomPriceType typeofroom) {
  27.  
  28. this.daysinhotel = daysinhotel;
  29. this.dinner = dinner;
  30. this.adults = adults;
  31. this.children = children;
  32. this.typeofroom = typeofroom;
  33.  
  34.  
  35.  
  36. !!!! ->>> ezt a részt nem lehetne egyszerűsíteni?
  37. switch (typeofroom){
  38. case ONESTAR: finalprize = 10000*adults*daysinhotel;
  39. case TWOSTAR: finalprize = 20000*adults*daysinhotel;
  40. case THREESTAR: finalprize = 30000*adults*daysinhotel;
  41. for (int i = 0; i < numberofpeople.length; i++) {
  42. numberofpeople[i] += 1;
  43. if (children>numberofpeople.length){
  44. System.out.println("Need another room");
  45. available=false;
  46. }
  47. }
  48. default: available=false;
  49. System.out.println("haventgotthisstar");
  50. }
  51. }
  52.  
  53.  
  54.  
  55.  
  56.  
  57. public HotelType(int[] numberofpeople, int daysinhotel, int adults, RoomPriceType typeofroom) {
  58. this.numberofpeople = numberofpeople;
  59. this.daysinhotel = daysinhotel;
  60. this.adults = adults;
  61. this.children = 0;
  62. this.typeofroom = typeofroom;
  63. }
  64.  
  65. public boolean needDinner(int adults){
  66.  
  67. }
  68.  
  69. public boolean moreGuest(){
  70.  
  71. }
  72.  
  73. public
  74.  
  75.  
  76.  
  77. @Override
  78. public String toString() {
  79. return "HotelType{" +
  80. "itsclean=" + itsclean +
  81. ", numberofpeople=" + Arrays.toString(numberofpeople) +
  82. ", daysinhotel=" + daysinhotel +
  83. ", dinner=" + dinner +
  84. ", adults=" + adults +
  85. ", children=" + children +
  86. ", available=" + available +
  87. ", typeofroom=" + typeofroom +
  88. ", finalprize=" + finalprize +
  89. '}';
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement