Question: Java coding. Part A Create a user-defined class called Building that consists of the data and methods for the building. Include data and methods for
Part A Create a user-defined class called "Building" that consists of the data and methods for the building. Include data and methods for the following: (0.5 point) Declaration of instance variables for Building includes number of floor, number of apartment per floor and average apartment square footage. (1 point) Two Constructors -default constructor that have the following default value number of floor is 1, number of apartments per floor is 2 and average apartment square footage is 1000 & the non-default that sets all instance variables. (1 point) Two Accessor Methods- returns each value of the floor and number of apartment information separately. (1 point) Three Mutator Methods- assigns a new value to each instance variable individually. These are the only two methods allowed to change the instance variables directly. (1.5 point) An expand method-"expand/increment" a building instance variables number of floor, number of apartment by addition floor numbers and addition of apartment per floor argument. (1.5 points) totalSalePrice- returns the building sale price provided pricePerSqFt as argument. The sale price is the pricePerSqFt multiplied by the number of apartment per floor multiplied by the average square feet multiplied by the number of floor (2 points) createUserid that return userid. createUserid is a class method (not tied to an object) that takes two String arguments, firstName and lastName (you can assume no embedded spaces in either, and assume both are not empty Strings), and returns a String userid of the following form: 1. 2. 3. 4. 5. 6. 7. all lowercase a. b. take the first initial of the name and the first 7 character of the last name i.e. my userid is otannous 8. (0.5 points) toString0 method- displays the current Building instance in this format public class Building f // declare your instance variables here "(number of floor, number of apartment per floor, average apartment square footage)" 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
