Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE JAVA Q2. (a) Create a class based on the following class diagram House type: String - zone: char price: double - numberOfBedrooms: int -
USE JAVA
Q2. (a) Create a class based on the following class diagram House type: String - zone: char price: double - numberOfBedrooms: int - freehold: boolean + House( + House (type: String, price: double, numberOfBedrooms: int) +House(type: String, zone: char, price: double, numberOfBedrooms: int, freehold: boolean) +all setters and getters + toString): Strin Note: i) Initalize the value of type to "Apartment", zone to 'A', price to 68000.00, numberOfBedrooms to 3 and freehold to false for no-arg constructor ii) Use toString ) method to print out all house details. (15 marks) Create a driver program for the class you create on part (a) to test all the available constructors and methods i) Create three house objects ii) Create an array to store the three house objects. (b) (4 marks) (6 marks) Modify the House class by using this keyword to refer to the data member(s) and constructor (if possible) (c)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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