Write a program to create a class called ShapeObject and this class contains the below,

Write a program to create a class called ShapeObject and this class contains the below,

Write a program to create a class called ShapeObject and this class contains the below,

1) String data field to called “Color”

2) Default constructor (no-arg) to create an object with “RED” color by default

3) An argument constructor to create the object with specified color.

4) A method names toString() that returns the description of the ShapeObject.

Create a class called Triangle that extends from ShapeObject. The class contains:

1) Three double data fields called side1, side2 and side3

2) Default constructor (no-arg) that creates default Triangle with (1,1,1)

3) An argument constructor to create the object with specified side1, side2 and side3 values.

4) An argument constructor to create the object with specified side1, side2 and side3 values and color from parent class.

5) Accessor methods to all three data fields

6) Mutator methods to all three data fields

7) A method called getSemi_Perimeter() that returns Semi_Perimeter of the triangle

8) A method names toString() that returns the description of the Triangle.

Finally create a TestClass to create 3 objects for Triangle class.

Sample Call in Test Program:

Triangle_Object_1 = Triangle()

Semi_Perimeter of Triangle_Object_1  = 1.5

Description of Triangle_Object_1  : Side1 = 1, Side2=1, Side3=1 and the color is RED and the Semi_Perimeter is 1.5

Triangle_Object_2 = Triangle(4,5,6)

Semi_Perimeter of Triangle_Object_2  = 7.5

Description of Triangle_Object_2  : Side1 = 4, Side2=5, Side3=6 and the color is RED and the Semi_Perimeter is 7.5

Triangle_Object_3 = Triangle(2,2,4,”GREEN”)

Semi_Perimeter of Triangle_Object_3  = 4.0

Description of Triangle_Object_3  : Side1 = 2, Side2=2, Side3=4 and the color is GREEN and the Semi_Perimeter is 4.0

Hint:

To calculate the Semi_Perimeter of the triangle, use the below formulae,

Semi_Perimeter = (a +b + c) / 2

Submission Requirement:

Please you need to submit your work in word format, and  each question should provide the below requirements:

  • The code
  • The results in screenshots

"96% of our customers have reported a 90% and above score. You might want to place an order with us."

Essay Writing Service
Affordable prices

You might be focused on looking for a cheap essay writing service instead of searching for the perfect combination of quality and affordable rates. You need to be aware that a cheap essay does not mean a good essay, as qualified authors estimate their knowledge realistically. At the same time, it is all about balance. We are proud to offer rates among the best on the market and believe every student must have access to effective writing assistance for a cost that he or she finds affordable.

Caring support 24/7

If you need a cheap paper writing service, note that we combine affordable rates with excellent customer support. Our experienced support managers professionally resolve issues that might appear during your collaboration with our service. Apply to them with questions about orders, rates, payments, and more. Contact our managers via our website or email.

Non-plagiarized papers

“Please, write my paper, making it 100% unique.” We understand how vital it is for students to be sure their paper is original and written from scratch. To us, the reputation of a reliable service that offers non-plagiarized texts is vital. We stop collaborating with authors who get caught in plagiarism to avoid confusion. Besides, our customers’ satisfaction rate says it all.

© 2022 Homeworkcrew.com provides writing and research services for limited use only. All the materials from our website should be used with proper references and in accordance with Terms & Conditions.

Scroll to Top