Skip to content

Instantly share code, notes, and snippets.

@jayanath
Created July 30, 2012 19:44
Show Gist options
  • Save jayanath/3209525 to your computer and use it in GitHub Desktop.
Save jayanath/3209525 to your computer and use it in GitHub Desktop.
Room
public class Room {
//this annotation helps spring to identify the constructor
//argument names when we compile the classes without debug
//enabled
@ConstructorProperties({"roomType"})
public Room(String roomType) {
this.roomType = roomType;
}
public double calculateRoomCharge() {
double total = 0;
for (Service service : serviceList) {
total = total + service.calculateServiceCharge();
}
return total;
}
public List<String> getUsedServiceNames() {
List<String> names = new ArrayList<String>();
for (Service service : serviceList) {
names.add(service.printServiceInfo());
}
return names;
}
public void setServiceList(List<Service> serviceList) {
this.serviceList = serviceList;
}
public String getRoomType() {
return roomType;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment