Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The below codes the class shell and instance variables for a Building class with the following attributes: Instance Variable Description Examples width building width (width>0)

The below codes the class shell and instance variables for aBuildingclass with the following attributes:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Instance Variable Description Examples width building width (width>0) 100.5,250.0 height building height (height>0) 360.3,905.0 builderName 3 or more characters "Ellen", "Roberts" floors number of floors (floors>0) 1,2,3,.. costPerMetre the cost of building one 300.0,1500.5 square metre of a floorpublic class Building { private double width=0, height=0, costPerMetre=0; private String builderName=null; private int floors=0; public Building(double width, double height, String builderName) { super ( ) ; this. setWidth (width) ; this. setHeight (height); this. setBuilderName (builderName) ; public double getwidth( ) { return width; public boolean setWidth (double width) { if(width > 0) { this. width = width; return true; return false;public double getHeight( ) { return height; public boolean setHeight(double height) { if(height > 0) { this. height = height; return true; return false; public double getCostPerMetre() { return costPerMetre; public boolean setCostPerMetre (double costPerMetre) { if(costPerMetre > 0) { this. costPerMetre = costPerMetre; return true; return false; public String getBuilderName( ) { return builderName;public boolean setBuilderName(String builderName) { if(builderName . length( ) > 2) { this. builderName = builderName; return true; return false; public int getFloors( ) { return floors; * @param floors - allowed values are from 1 to 150 inclusive * return public boolean setFloors(int floors) { if(floors > 0 && floors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

C H 3 M g B r ( 2 equiv ) H 3 O + longrightarrow

Answered: 1 week ago