Menu

Abstract Java Houses Bob Contactor Computer Scientist Work Trailers Track Work Wrote Progr Q43823599

Abstract Java Houses

Bob is a Contactor and Computer Scientist who does work ontrailers. To track his work he wrote a program that tracked: howmuch money he made and how many trailers he’d worked on.

This program has the capacity to be very useful for any jobinvolving homes: mansions, bungalows, condos, etc. To make thisprogram more marketable to a wider audience it needs to berefactored into a generic program using abstract classes. By makinga job class other than Contractor and another home-type class theprogram will become valuable to many more people. Your task isto:

Write the abstract class, abstractHouse, which has:
an integer variable for the number of rooms in the house
a double variable for the value of the house
an integer variable for the amount of work required on thehouse
an integer variable to act as a work counter, tracking the amountof work done on the house
an abstract void method to calculate the value of the house
an abstract Boolean method to perform work
Write the Mansion class implementing the abstractHouse class. Youmay refer to the Trailer class for hints on implementation. TheMansion class must have:
an integer variable for the number of floors
a Boolean variable indicating if it has a driveway, if it has oneincrease the house value by 200 and work required of the house by20
a Boolean variable indicating if it is furnished, if it is increasethe value by 500 and work required by 100
implemented abstract methods
a constructor that takes as input the number of rooms, the numberof floors, a Boolean value hasDriveway and a Boolean valueisFurnished.
Write a class for a job that involves working with houses otherthan the Contractor. You may refer to the Contractor class forimplementation ideas. This class must:
maintain a Queue of houses that are either being currently workedon, or will be worked on
call the implemented abstract methods in the queue
a double variable, wallet, initially at 0 that tracks the amount ofmoney earned from completing house jobs
an integer counter, tracking the number of houses completed
when complete all jobs, summarize the number of jobs completed andamount earned
randomly add new jobs of a random house type, be careful with thisas you could enter an infinite loop. Refer to the numbers used inContractor for an approach.

Exceed the Expectations: Does the doWork() method need to beabstract? Try to refactor the program so that doWork() is notabstract but may call an abstract method.

Expert Answer


Answer to Abstract Java Houses Bob is a Contactor and Computer Scientist who does work on trailers. To track his work he wrote a p…

OR