Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views2 pages

Room

The document defines a Java class named 'Room' that encapsulates properties such as id, name, availability, number of days, and price. It includes a constructor, getter and setter methods for each property, a method to calculate total payment, and an overridden toString method for string representation. This class can be used to manage room information in a hotel or rental application.

Uploaded by

24002071
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Room

The document defines a Java class named 'Room' that encapsulates properties such as id, name, availability, number of days, and price. It includes a constructor, getter and setter methods for each property, a method to calculate total payment, and an overridden toString method for string representation. This class can be used to manage room information in a hotel or rental application.

Uploaded by

24002071
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

public class Room {

private String id;


private String name;
private boolean available;
private int days;
private double price;

public Room() {

public Room(String id, String name, boolean available, int days, double price)
{
this.id = id;
this.name = name;
this.available = available;
this.days = days;
this.price = price;
}

public String getId() {


return this.id;
}

public void setId(String id) {


this.id = id;
}

public String getName() {


return this.name;
}

public void setName(String name) {


this.name = name;
}

public boolean getAvailable() {


return this.available;
}

public void setAvailable(boolean available) {


this.available = available;
}

public int getDays() {


return this.days;
}

public void setDays(int days) {


this.days = days;
}

public double getPrice() {


return this.price;
}

public void setPrice(double price) {


this.price = price;
}
public double getPayment() {
return price*days;

@Override
public String toString() {
return "Room [id=" + getId()
+ ", name=" + getName()
+ ", available=" + getAvailable()
+ ", days=" + getDays()
+ ", price=" + getPrice() + "]";
}
}

You might also like