Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

Students also viewed these Databases questions

Question

Which one is the optimal cluster?

Answered: 1 week ago