Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Use this method to change the status of the check in/check out
- *
- */
- private void changeGuestCheck(String sBookingInput) {
- Booking selectedBooking = Bookings.get(Integer.parseInt(sBookingInput));
- //Guest selectedGuest = Guests.get(Integer.parseInt(sBookingInput));
- Guest selectedGuest = Guests.stream()
- .filter(Guest -> Guest.getsMail().equals(selectedBooking.getsMail()))
- .findAny()
- .orElse(null);
- selectedGuest.setbCheckedIn(false);
- Guests.set(Integer.parseInt(sBookingInput), selectedGuest);
- }
- /**
- * Use this method to change the status of a specifik spot depending on the booking
- */
- private void changeSpotCheck(String sBookingInput) {
- Booking selectedBooking = Bookings.get(Integer.parseInt(sBookingInput));
- //Guest selectedGuest = Guests.get(Integer.parseInt(sBookingInput));
- Spot selectedSpot = Spots.get(selectedBooking.getiSpotNR());
- selectedSpot.setbVacant(true);
- Spots.set(Integer.parseInt(sBookingInput), selectedSpot);
- }
- /*
- Skapar en instans av bokningen och skriver ut den
- Use this method to display a specifik booking and print it out
- */
- private void displayBooking(String sBookingInput) {
- Booking selectedBooking = Bookings.get(Integer.parseInt(sBookingInput));
- System.out.println(selectedBooking);
- }
- /**
- * Use this method to fetch the income from an accomendation
- * returns integer result with cottage-, trailer- or tentprice
- */
- public int[] calMoneyEarned() {
- int iCottagePrice = 0;
- int iTrailerPrice = 0;
- int iTentPrice = 0;
- for (int counter = 0; counter < Bookings.size(); counter++) {
- Booking selectedBooking = Bookings.get(counter);
- String sAccType = selectedBooking.getsAccommodation();
- switch (sAccType) {
- case "Cottage":
- iCottagePrice += selectedBooking.getiTotalbill();
- break;
- case "RV":
- iTrailerPrice += selectedBooking.getiTotalbill();
- break;
- case "Tent":
- iTentPrice += selectedBooking.getiTotalbill();
- break;
- }
- }
- int iTotalRevenue = iCottagePrice + iTrailerPrice + iTentPrice;
- int[] result = new int[4];
- result[0] = iTotalRevenue;
- result[1] = iCottagePrice;
- result[2] = iTrailerPrice;
- result[3] = iTentPrice;
- return result;
- }
- /**
- * Use this method to
- */
- public int[] calEarned() {
- int iCottageGuest = 0;
- int iTrailerGuest = 0;
- int iTentGuest = 0;
- for (int counter = 0; counter < Bookings.size(); counter++) {
- Booking selectedBooking = Bookings.get(counter);
- String sAccType = selectedBooking.getsAccommodation();
- switch (sAccType) {
- case "Cottage":
- iCottageGuest ++;
- break;
- case "RV":
- iTrailerGuest ++;
- break;
- case "Tent":
- iTentGuest ++;
- break;
- }
- }
- int iTotalRevenue = iCottageGuest + iTrailerGuest + iTentGuest;
- int[] result = new int[4];
- result[0] = iTotalRevenue;
- result[1] = iCottageGuest;
- result[2] = iTrailerGuest;
- result[3] = iTentGuest;
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement