Create a Triangle class that extends the SimpleGeometricObject class in Eclipse, following the below UML diagram. Use the following formula to calculate the area of a triangle: A = 1/2 × base × height the SimpleGeometricObject code is below in link and picture https://liveexample.pearsoncmg.com/html/SimpleGeometricObject.html the ending part of the code and didnt appear in the picture } /** Return a string representation of this object */ public String toString() { return "created on " + dateCreated + "\ncolor: " + color + " and filled: " + filled; } }
Create a Triangle class that extends the SimpleGeometricObject class in Eclipse, following the below UML diagram. Use the following formula to calculate the area of a triangle: A = 1/2 × base × height the SimpleGeometricObject code is below in link and picture https://liveexample.pearsoncmg.com/html/SimpleGeometricObject.html the ending part of the code and didnt appear in the picture } /** Return a string representation of this object */ public String toString() { return "created on " + dateCreated + "\ncolor: " + color + " and filled: " + filled; } }
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5PE
Related questions
Concept explainers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question
Create a Triangle class that extends the SimpleGeometricObject class in Eclipse, following
the below UML diagram.
the below UML diagram.
Use the following formula to calculate the area of a triangle:
A = 1/2 × base × height
A = 1/2 × base × height
the SimpleGeometricObject code is below in link and picture
https://liveexample.pearsoncmg.com/html/SimpleGeometricObject.html
the ending part of the code and didnt appear in the picture
}
/** Return a string representation of this object */
public String toString() {
return "created on " + dateCreated + "\ncolor: " + color +
" and filled: " + filled;
}
}
![+ base:double = 5
+ height:double = 10
Triangle
Page
TASK 1: Create a Triangle class that extends the Simple GeometricObject class in Eclipse, following
the below UML diagram.
+ Triangle()
+ Triangle(newBase: double, newHeight: double)
+ getArea(): double
+ setBase(): void
+ setHeight(): void
+ getBase(): double
+ getHeight(): double
1
of 3
ZOOM
+
*k](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2ae76079-938b-4b5d-8ceb-1dfbc10f88ce%2F387c137e-3c43-43ea-8e9b-02505d14a921%2F7rdsmk2f_processed.png&w=3840&q=75)
Transcribed Image Text:+ base:double = 5
+ height:double = 10
Triangle
Page
TASK 1: Create a Triangle class that extends the Simple GeometricObject class in Eclipse, following
the below UML diagram.
+ Triangle()
+ Triangle(newBase: double, newHeight: double)
+ getArea(): double
+ setBase(): void
+ setHeight(): void
+ getBase(): double
+ getHeight(): double
1
of 3
ZOOM
+
*k
![Lab 5: Inheritance
← → C
public class SimpleGeometricObject {
private String color = "white";
private boolean filled;
private java.util.Date dateCreated;
X
liveexample.pearsoncmg.com/html/SimpleGeometricObject.html
/** Construct a default geometric object */
public SimpleGeometricObject() {
dateCreated = new java.util.Date();
dateCreated
this.color = color;
this.filled = filled;
}
/** Construct a geometric object with the specified color
* and filled value */
public SimpleGeometricObject(String color, boolean filled) {
Introduction to Java Programmin X b Home | bartleby
}
/** Return color */
public String getColor() {
return color;
new java.util.Date();
}
/** Set a new color */
public void setColor (String color) {
this.color = color;
34°F
Cloudy
}
/** Return filled. Since filled is boolean,
its get method is named isFilled */
public boolean isFilled() {
return filled;
}
/** Set a new filled */
public void setFilled (boolean filled) {
this.filled = filled;
}
/** Get dateCreated */
public java.util.Date getDateCreated() {
return dateCreated;
}
▬▬
■
Q Search
x +
a
Pa
N
1x O
0
5:43 PM
3/21/2023
X
:](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2ae76079-938b-4b5d-8ceb-1dfbc10f88ce%2F387c137e-3c43-43ea-8e9b-02505d14a921%2Fmgoiuhj_processed.png&w=3840&q=75)
Transcribed Image Text:Lab 5: Inheritance
← → C
public class SimpleGeometricObject {
private String color = "white";
private boolean filled;
private java.util.Date dateCreated;
X
liveexample.pearsoncmg.com/html/SimpleGeometricObject.html
/** Construct a default geometric object */
public SimpleGeometricObject() {
dateCreated = new java.util.Date();
dateCreated
this.color = color;
this.filled = filled;
}
/** Construct a geometric object with the specified color
* and filled value */
public SimpleGeometricObject(String color, boolean filled) {
Introduction to Java Programmin X b Home | bartleby
}
/** Return color */
public String getColor() {
return color;
new java.util.Date();
}
/** Set a new color */
public void setColor (String color) {
this.color = color;
34°F
Cloudy
}
/** Return filled. Since filled is boolean,
its get method is named isFilled */
public boolean isFilled() {
return filled;
}
/** Set a new filled */
public void setFilled (boolean filled) {
this.filled = filled;
}
/** Get dateCreated */
public java.util.Date getDateCreated() {
return dateCreated;
}
▬▬
■
Q Search
x +
a
Pa
N
1x O
0
5:43 PM
3/21/2023
X
:
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT