Question: The code below includes a live TreeHouse variable, danasHouse, which you cannot see. Using commands that are described in the TreeHouse API, write one or

The code below includes a live TreeHouse variable, danasHouse, which you cannot see. Using commands that are described in the TreeHouse API, write one or several lines of code that will print to the console a boolean value, true or false, depending on whether danasHouse is dangerous.

Field Summary
private int heightAboveGround Tree house height above ground
private int length Tree house length
private java.lang.String treeKind Tree house kind of tree, e.g. oak
private int width Tree house width

Constructor Summary
TreeHouse(int theWidth, int theLength, int theHeight, java.lang.String tree) the tree house constructor

Method Summary
int area() Gives tree house area
boolean dangerous() Determines if tree house is dangerous - 10 or more feet high
int getHeight() Gives height of tree house above ground
int getLength() Gives tree house length
java.lang.String getTree() Gives tree type
int getWidth() Gives tree house width

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

width

private int width 

Tree house width

length

private int length 

Tree house length

heightAboveGround

private int heightAboveGround 

Tree house height above ground

treeKind

private java.lang.String treeKind 

Tree house kind of tree, e.g. maple

Constructor Detail

TreeHouse

public TreeHouse(int theWidth, int theLength, int theHeight, java.lang.String tree) 

the tree house constructor

Parameters:

theWidth - the width of the house

theLength - the length of the house

theHeight - the height of the house above ground

tree - the kind of tree

Method Detail

getWidth

public int getWidth() 

Gives tree house width

Returns:

width of tree house

getLength

public int getLength() 

Gives tree house length

Returns:

length of tree house

getHeight

public int getHeight() 

Gives height of tree house above ground

Returns:

height of tree house

getTree

public java.lang.String getTree() 

Gives tree type

Returns:

the kind of tree

area

public int area() 

Gives tree house area

Returns:

area of tree house

dangerous

public boolean dangerous() 

Determines if tree house is dangerous - 10 or more feet high

Returns:

true if height is ten feet or higher

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!