subject

Create a class called Tree. It is required to have the following: 4 fields o name, String, the type of tree (pine, cedar, oak, etc.). o age, integer, the approximate age of the tree. o circumference, double, the approximate circumference of the tree (in inches). omarker, boolean, indicates if the tree has a marker on it. This is true if it has a marker and false if it doesn't. 7 methods o a constructor that accepts as arguments the values for the fields above, in the order listed. o a copy constructor that makes a copy of a Tree object. o a setCircumference method that accepts a double argument, which is used to set the circumference field. o a setMarker method that accepts a boolean argument, which is used to set the marker field. o a radius method that has no arguments and returns a double that is the radius of the tree. The radius can be calculated as radius = circumference /(2 x PI). Pl is 3.14. o an equals method that returns a boolean indicating if two objects contain the same information. If they do, it returns true, false otherwise. The objects contain the same information when the name and age fields indicate the same values. o a toString method that returns a String that contains on separate lines (5 lines), the names and values for each field, and the radius. Display double values to 2 decimal places. Demonstrate your class in a program. Your demo program is required to: • create at least two Tree objects. • create a copy of a Tree object. • use each of the other five methods to show they work properly. You may have to use a method more than once to show it works properly. • do not explicitly call the toString method in your demo program. Call it implicitly. Your class and demo program are required to: • be properly commented • follow the programming conventions we used in the course have appropriate variable names the Tree class must be in a separate file. ​

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
question
Computers and Technology, 23.06.2019 13:00
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
Pseudocode pld #6, pg. 117 start// declarations// number numbertoguess// number myguess; numbertoguess = 92// while myguess ! = numbertoguess// output " guess an integer number between 1 and 100"// input myguess// if (myguess == numbertoguess)// output "you guessed the correct number"// else// output "the number you guessed was incorrect. try again! "// end if// end while// output " for playing the guessing game. have a great day! "// stop
Answers: 3
question
Computers and Technology, 25.06.2019 08:30
What is the chief concern of cloud computing?
Answers: 1
You know the right answer?
Create a class called Tree. It is required to have the following: 4 fields o name, String, the type...
Questions