Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Garage extends Building {
- private int cars;
- private GarageFlooring flooring;
- private int length;
- private int width;
- public enum GarageFlooring {
- CEMENT, GRAVEL
- }
- public Garage(int windows, int cars, GarageFlooring flooring, int length,
- int width) {
- super(windows);
- this.cars = cars;
- this.flooring = flooring;
- this.length = length;
- this.width = width;
- }
- public int getCars() {
- return cars;
- }
- public void setCars(int cars) {
- this.cars = cars;
- }
- public int getLength() {
- return length;
- }
- public void setLength(int length) {
- this.length = length;
- }
- public int getWidth() {
- return width;
- }
- public void setWidth(int width) {
- this.width = width;
- }
- public int area() {
- int result;
- result = this.length * this.width;
- return result;
- }
- @Override
- public String toString() {
- String result;
- result = "-Garage-\nCars: " + cars + "\nLength: " + length
- + "' - Width: " + width + "' - Area: " + area()
- + "'\nFlooring: " + flooring;
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement