Design a new Triangle class that extends the abstract GeometricObject class, implement the Comparable interface. Override...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Design a new Triangle class that extends the abstract GeometricObject class, implement the Comparable interface. Override the equals method in the Object class. A Triangle is represented by its three side length side 1, side2, and side3, a color, and a Boolean value to indicate whether the triangle is filled. Two Triangle objects are equal if their sides, color and filled are the same. It should also compare two Triable objects whether one is equal to, greater than or less then from the other object using area sizes of objects. Write a test program that generates several Triangle objects with three sides, a color, and a Boolean value filled. The program should display each triangle's area, perimeter, color, and true or false to indicate whether it is filled or not; compare two Triangles objects with equals method; compare two Triangles objects using compare To method whether they are equal to, greater than or less then in area size. Draw the UML diagram that involves Triangle, GeometricObject, and Comparable. Hint: Use Heron Formula with sides a, b, and c to find the area of a triangle: a+b+c 2 Area= s(s-a)(s-b)(sc) Design a new Triangle class that extends the abstract GeometricObject class, implement the Comparable interface. Override the equals method in the Object class. A Triangle is represented by its three side length side 1, side2, and side3, a color, and a Boolean value to indicate whether the triangle is filled. Two Triangle objects are equal if their sides, color and filled are the same. It should also compare two Triable objects whether one is equal to, greater than or less then from the other object using area sizes of objects. Write a test program that generates several Triangle objects with three sides, a color, and a Boolean value filled. The program should display each triangle's area, perimeter, color, and true or false to indicate whether it is filled or not; compare two Triangles objects with equals method; compare two Triangles objects using compare To method whether they are equal to, greater than or less then in area size. Draw the UML diagram that involves Triangle, GeometricObject, and Comparable. Hint: Use Heron Formula with sides a, b, and c to find the area of a triangle: a+b+c 2 Area= s(s-a)(s-b)(sc)
Expert Answer:
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Design a new Triangle class that extends the abstract GeometricObject class. Draw the UML diagram for the classes Triangle and GeometricObject then implement the Triangle class. Write a test program...
-
Programming Exercise 11.1 defined the Triangle class with three sides. In a triangle, the sum of any two sides is greater than the other side. The Triangle class must adhere to this rule. Create the...
-
Debbie Walker earns a salary of $4,000 per month during the year.Employment Insurance taxes (EI) are 1.88% of the first $49,500 in earnings. The Canadian Pension Plan (CPP) rate is 4.95% of the first...
-
Refer to Exercise 12-25. Stanmore Corporation makes a special-purpose machine, D4H, used in the textile industry. Stanmore has designed the D4H machine for 2017 to be distinct from its competitors....
-
The Association of Women in Government established an Educational Foundation to raise money to support scholarship and other education initiatives. The Educational Foundation is a private...
-
As shown in the ASPEN PLUS simulation flowsheet in Fig. 21.15, liquid toluene is to be heated from 100 to \(350^{\circ} \mathrm{F}\) while liquid styrene is to be cooled from 300 to \(100^{\circ}...
-
Vasquez Ltd. is a retailer operating in Edmonton, Alberta. Vasquez uses the perpetual inventory method. All sales returns from customers result in the goods being returned to inventory; the inventory...
-
How do you manage your time? Do you plan your day or just see what happens? What works best for you? What is your biggest time waster?
-
The following trial balance was extracted from the books of Old NV on 31 December 20X1. Note of information not taken into the trial balance data: (a) Provide for: (i) An audit fee of 38,000. (ii)...
-
Assume that Vietnam has imposed no tariff on imports for vehicles. Present a graph showing this free trade situation, using Vietnams production possibility curve for vehicles and for iron&steel....
-
Suppose the Bank of Canada sells $50,000 in bonds to Bank 1, and Bank 1 and all other banks have no excess reserves prior to this purchase. a. What type of policy is this? A. Contractionary fiscal...
-
Coulomb's law for the magnitude of the force F between. wo particles with charges Q and Q' separated by at distance d is |F| = K 20 1 where K = and 4760 08.854 x 10-12 C2/(N m) is the permittivity of...
-
You are looking to purchase a house valued at $325,000 in the suburbs of Kansas City. You decide to pay 20% of the value of the house as down payment and borrow the rest at an APR of 3.20% for 20...
-
Work in process inventory, May 1 Work in process inventory, May 31 69,000 100% 50% 49,000 100% 30% Materials cost in work in process inventory, May 1 Conversion cost in work in process inventory, May...
-
Cullumber Corporation issues $424,000 of 7%, 5-year bonds on January 1, 2022, at 105. Assuming that the straight-line method is used to amortize the premium, what is the total amount of interest...
-
Compare series, shunt and chopper type JFET switch
-
In a system with light damping (c < cc), the period of vibration is commonly defined as the time interval d = 2/d corresponding to two successive points where the displacement-time curve touches one...
-
Rewrite the preceding servlet. Assume for each class, a table is used to store the student name, ssn, and score. The table name is the same as the class ID. For instance, if the class ID were...
-
Write a program that finds all prime numbers up to 10,000,000,000. There are approximately 455,052,511 such prime numbers. Your program should meet the following requirements: Your program should...
-
Write a program using tab panes for performing integer and rational number arithmetic as shown in Figure 31.58. Exercise31_21 Exercise31,21 Integer Operations Rational Operations Integer Oparations...
-
Carry out an Internet search to find more examples of project success and failure. From your search, are there any common themes in each? What are the implications of success and failure in each case?
-
How successful are government contracting arrangements? How do these compare, for instance, with the arrangements BAA had with their suppliers in the construction of T5 at Heathrow (Project...
-
What is the role of brainstorming and how might it be used to greatest effect?
Study smarter with the SolutionInn App