Hotel-Management-Project-Java icon indicating copy to clipboard operation
Hotel-Management-Project-Java copied to clipboard

Rooms store unnecesary values

Open dsantistevan opened this issue 5 years ago • 1 comments

In the following code there's a violation to the Single Responde Principle of SOLID design.

public class Singleroom implements Serializable{
    String name;
    String contact;
    String gender;   
    ArrayList<Food> food =new ArrayList<>();`

class Doubleroom extends Singleroom implements Serializable
{ 
    String name2;
    String contact2;
    String gender2;  

The room stores the people that stay in the room, but doesn't need to store the personal info, there should be a new class of Guest that stores these values and the rooms only need to have this as their instance variable.

dsantistevan avatar Jul 12 '20 23:07 dsantistevan

May i work on this issue?

Rishi6229 avatar Jun 20 '21 14:06 Rishi6229