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 14:10
Dean wants a quick way to look up staff members by their staff id. in cell q3, nest the existing vlookup function in an iferror function. if the vlookup function returns an error result, the text “invalid staff id” should be displayed by the formula. (hint: you can test that this formula is working by changing the value in cell q2 to 0, but remember to set the value of cell q2 back to 1036 when the testing is complete.)
Answers: 3
question
Computers and Technology, 22.06.2019 14:30
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
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
question
History, 16.06.2021 19:40
question
Mathematics, 16.06.2021 19:40
question
Biology, 16.06.2021 19:40
question
Mathematics, 16.06.2021 19:40
question
Mathematics, 16.06.2021 19:40
question
Mathematics, 16.06.2021 19:40
question
English, 16.06.2021 19:40
Questions on the website: 13722363