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 02:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print?
Answers: 3
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
question
Computers and Technology, 24.06.2019 03:00
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
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
question
Mathematics, 01.12.2020 16:50
question
Biology, 01.12.2020 16:50
Questions on the website: 13722363