Advertisement
Vladkoheca

Room.java

Jan 10th, 2025
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | Source Code | 0 0
  1. public class Room {
  2.     private int roomNumber;
  3.     private double pricePerNight;
  4.  
  5.     public Room(int roomNumber, double pricePerNight) {
  6.         this.roomNumber = roomNumber;
  7.         this.pricePerNight = pricePerNight;
  8.     }
  9.     public double calculateTotalCost(int nights) {
  10.         return (pricePerNight * nights);
  11.     }
  12.  
  13.     public double getPricePerNight() {
  14.         return pricePerNight;
  15.     }
  16.  
  17.     public int getRoomNumber() {
  18.         return roomNumber;
  19.     }
  20.  
  21.     public void setPricePerNight(double pricePerNight) {
  22.         this.pricePerNight = pricePerNight;
  23.     }
  24.  
  25.     public void setRoomNumber(int roomNumber) {
  26.         this.roomNumber = roomNumber;
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement