Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 1. Write a Java class called ResidenceListing, representing a house (residence) that is listed for sale. Add these members: (a) Fields to represent the
Assignment 1. Write a Java class called ResidenceListing, representing a house (residence) that is listed for sale. Add these members: (a) Fields to represent the house's number of bedrooms (integer), number of bathrooms (a house can have fractions of a bathroom; a room with only a sink and toilet is considered "half a bathroom); street address (ex: 42 Wallaby Way); city (ex: Sydney); integer number of square feet of area (ex: 1090); and sale price in integer dollars. A constructor that takes one parameter for each of the fields, and initializes the fields with the corresponding parameters. (c) Writer accessors ("getters) for all of the class fields. (d) Write a mutator ("setter) for the sale price only; this void method should take a new sale price as its parameter, and change the field to reflect the new price. (e) Write a method pricePerSquareFoot, which returns the square foot area divided by the sale price. Be careful of integer division. How to Get Credit Show me: 1. The source code for your ResidenceListing class
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