Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please inspect the following design and answer the following question. class Apartment { protected int squareFootage: protected int numberOfBedrooms. } public int getBedroom Count()
Please inspect the following design and answer the following question. class Apartment { protected int squareFootage: protected int numberOfBedrooms. } public int getBedroom Count() { return numberOfBedrooms; } public void addBedRoom (int saft) { this square footage = saft; this numberOfBedrooms += 1; } } class PenthouseSuite extends Apartment { public PenthouseSuite() { this numberOfBedrooms = 4; } class Studio extends Apartment { public Studio() { this numberOfBedrooms = 0; } public void addBedRoom (int saft) { this square footage = saft: } a. Which SOLID design principle does the above design violate? (3pts) b. Illustrate with an example code to show how the above design can cause issues. (7pts)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The image contains a code snippet displaying a class inheritance hierarchy in an objectoriented programming design It shows a base class Apartment wit...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started