Write a program to create a class called ShapeObject and

 

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 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

patient file

Your final project for this course will be a patient record analysis. You will apply the knowledge of anatomy, physiology, and pharmacology that you have developed during this course in a thorough review of existing patient information in the Final Project Patient File. Specifically, you will review a patient’s history

610 6-1 Discussion: Improve, Part Two—Mitigating Unwanted Consequences

 The Essential Workplace Conflict Handbook. Including the IMPROVE Supplementary Document. Next, in your initial post, address the following: • In what ways do you perceive the Improve phase as being informed by the other phases of DMAIC that you have worked with in the course thus far? • How can

Code of conduct

 For this assignment, Write a paper about employee codes of conduct using information from your textbook and at least two other scholarly sources. First, research employee codes of ethics, especially for the medical field. Next, find some examples of employee codes of ethics from medical facilities and choose the one

Human Growth and Development

Scenario: Simon Whitaker is 42 years old and has suffered from mental illness since his late teens. He lives in a flat in a large housing estate. He lost his job as a warehouse cleaner after he was admitted to hospital the last time he became ill, two years ago.

Exporting Security

Write a 2 page argumentative essay on the links provided below. Link 1: https://www.airuniversity.af.edu/SSQ/Book-Reviews/Article/1292320/exporting-security-international-engagement-security-cooperation-and-the-changi/ Link 2:https://digital-commons.usnwc.edu/cgi/viewcontent.cgi?article=1049&context=nwc-review Link 3: https://digital-commons.usnwc.edu/cgi/viewcontent.cgi?article=1049&context=nwc-review #Exporting #Security

Organizational culture and values

 Details: Prepare a 10-minute presentation (10-15 slides, not including title or reference slide) on organizational culture and values. Describe how alignment between the values of an organization and the values of the nurse impact nurse engagement and patient outcomes. Discuss how an individual can use effective communication techniques to overcome

Document Analysis

Document Analysis (5% – c. 500 words) Primary sources are writings that were produced by individuals or groups at the time of the historical events or issues that they deal with. A number of such documents have been placed on Blackboard, organized by course unit. This assignment requires you to

M3D1: Big Data

The discussion will examine the social interaction of participants regarding an issue or situation and its impact on research data. This discussion addresses the following module outcomes: •MO1: Become familiar with the process of conducting marketing research methods and research tools •MO2: Review the process marketers use for identifying and

Case Study 1 and 2 Pneumonia and Addison diseases

Review the case study and answer all questions with a scholarly response using APA and include 2 scholarly references. Answer both case studies on the same document and upload 1 document to Moodle. Case Studies will be uploaded to Moodle and put through TURN-It-In (anti-Plagiarism program) Turn it in Score

Should schools ban unhealthy snack machines?

 Your outline should include: An explanation of the controversial issue, why is it controversial? Identify which position or side you will take in your paper, and explain why. If you don’t agree with the position you are taking discuss how this could affect your argument on the topic. If you

The Outcome of Inequality of Wealth and Income

Research Topic: Submit an idea for a research study based on a business/economic problem. • Write the title of the study. • Explain your overarching aim for the study. • What is the problem? • What is the significance of it? • Draft at least two research questions. Due 1/27

“practice of professional engineering”

1. “practice of professional engineering” means any act of planning, designing, composing, evaluating, advising, reporting, directing or supervising that requires the application of engineering principles and concerns the safeguarding of life, health, property, economic interests, the public welfare or the environment, or the managing of any such act; (“exercice de

Curriculum Development and Evaluation

 Learning Materials: Keating, S. B. (2011). Curriculum development and evaluation in nursing (2nd ed.). New York: Springer. (Chapter 13) Books are on website Vital Source user name is sred9196@yahoo.com, the password is Bungalow9@ • Exercise #1: Address an educational need among nursing staff at a health care agency. In the

Epidemiology and Surveillance

Research the public health agency in Chicago, IL and develop a presentation on its structure, response capabilities, surveillance tools, and role in emergency management. In your response, include a description of the community served by the department (Chicago), its emergency response structure, surveillance systems that are used at hospitals, biohazard

General Psychology Application

 General Psychology Application Essay Over the course of the class, we have discussed a number of different psychological concepts and theories. For your paper you will be asked to connect a real life experience or observation with a concept or theory from lecture and/or your textbook. Your assignment should include

Issues and Trends in Curriculum Development

 Learning Materials: • Iwasiw, C., Goldenberg, D., & Andrusyszyn, M. (2009). Curriculum development in nursing education (2nd ed.). Boston: Jones & Bartlett. (Chapters 13 and 14) • Keating, S. B. (2011). Curriculum development and evaluation in nursing (2nd ed.). New York: Springer. (Chapters 16 and 17) PowerPoint • Chapter 13

Foundation of Nursing Module 2.1 ( Discussion)

Module 2.1 – Discussion Nursing Theories and Theorists Instructions: After reading the assigned chapters, please post two discussion questions based on the readings along with your answers to the following questions: Did any of the theories or theorist influence your own personal theory of nursing; and consequently, your own view