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, 21.06.2019 20:00
2.)how does a graphical user interface (gui) on a touchscreen interface differ from a gui on a desktop or laptop? a.)a finger or stylus is used instead of a pointer. b.) a magic wand is used instead of a pointer. c.)users speak commands instead of using a pointer. d.)users visualize commands instead of using a pointer.
Answers: 1
question
Computers and Technology, 22.06.2019 00:40
If you arrive at the same time as another user straight across from you yield if a. they flash your headlights at you b. you can’t see their turn signals c. you’re going street and they’re running d. you’re turning they’re going straight plz
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Which software would you use to create a print design? a. illustrator b. audacity c. reaper d. dreamweaver
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
Me if you do then you get 10 points and brainliest
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, 27.08.2019 23:20
Questions on the website: 13722361