Due: Tuesday October 17, 5:30 pm
Write two public classes Home and Tenant (in appropriate files), with the following specification. This specification, while it may seem informal, is complete.
A home has a permanent street address. This is given to a Home as a String when constructed, and there's a method getAddress to return this street address (again as a string).
A home also has an integer number of grams of gruel (a food) stored in its fridge. The amount of gruel starts at 0 grams. Whenever some gruel is bought or eaten, one calls the Home's adjustGruelBy method with the amount of gruel (positive if bought and negative if eaten). One can find out the amount of gruel by calling the Home's gruelInFridge method.
A tenant has a home, which is set by calling the Tenant's setHome method and passing it a Home. One can ask a Tenant its street address using the method getAddress.
A tenant has an appetite (an amount of gruel eaten per meal), which one gives to the Tenant when it is constructed. A Tenant can be told to buy gruel for its Home, using the Tenant's buyGruel method and giving the number of grams to buy. A Tenant can be told to eat a meal of gruel by calling its eat method; assume that when eat is called there is enough gruel in the tenant's home's fridge.
One can also ask a tenant if there's enough food in the fridge in their home for them to eat a meal, by calling canEat; canEat returns true or false as appropriate.
And finally, one can get a summary of a Tenant's status with its status method which returns a string in the following form:
Lives at: address. Can eat a meal: true/false.where address is replaced by the tenant's street address and true/false is replaced with either true or false as appropriate.
Further requirements:
Submit the files for Home and Tenant.