Question: PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU OR GIVE OU A DISLIKE [Q-9] 1. Basic Inheritance: Write a class named Dwelling that
PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU OR GIVE OU A DISLIKE

[Q-9] 1. Basic Inheritance: Write a class named Dwelling that can be used to represent a home. For each dwelling we need to record the name of the owner, the type of dwelling, the size of the dwelling (in square feet, for example 1235). and if the dwelling has a fireplace or not. We must be able to retrieve each of these pieces of information for any dwelling. We must also be able to calculate the annual insurance cost for a dwelling when told what the base rate for the cost per square foot is using this method: computelnsurance (double baseRate). The cost of insurance is also increased by $\$ 150$ if the dwelling has a fireplace. For example, If Basic Inheritance: Write a class named Dwelling that can be used to represent a home. For each dwelling we need to record the name of the owner, the type of dwelling, the size of the dwelling (In square feet, for example 1235), and if the dwelling has a fireplace or not. We must be able to retrieve each of these pieces of information for any dwelling. We must also be able to calculate the annual Insurance cost for a dwelling when told what the base rate for the cost per square foot is using this method: computeInsurance(double baseRate). The cost of insurance is also increased by $150 if the dwelling has a fireplace. For example, If the insurance rate is $4.56/square foot, the size of the dweling is 950 square feet, and the dwelling has a fireplace, the method will return 4482.0. Next, create a subclass of Dwelling named Town House. This class will be used to represent a dwelling that is a town house. Town houses are dwellings that are connected to each other in a row meaning that there are end units and also units that are in the middle which will effect the cost of their insurance. So, for each town house we must record if it is an end unit or not. Because town houses are attached their insurance is more. If a town house is an end unit they incur an additional annual charge for their insurance of $175, if it is not an end unit the additional charge is $250. Finally, create a third class named HomeBusiness. This class will also be a subclass of Dwelling. For dwellings that contain a business we must record the size of the business (in square feet). If the business takes up more than 50% of the total size of the dwelling then they are charged an additional $2.35/square foot for the size of the business, otherwise they are charged an additional $1.84/square foot for the size of the business
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
