Override the testOverriding() method in the Triangle class. Make it print “This is the overridden testOverriding() method”

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Override the testOverriding() method in the Triangle class. Make it print “This is the
overridden testOverriding() method”.
 
 
➡ eclipse-workspace - project2/src/project2/SimpleGeometricObject.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
DH
0-2 -2 - #Ⓒ
task8A.java
task8C.java
2
95.
6
3 private String color "white";
4 private boolean filled;
$10
11
12
130
14
$15
16
17
18
19
20
21
22
23
24
256
26
27
28
29
30
$31
32
Re public SimpleGeometricObject() [
33
34
356
37
39
40
41
42
846
reportsum6.java
47
48
49
51
852
package projectz;
public class SimpleGeometricObject [
private java.util.Date dateCreated;
1
1
public SimpleGeometricObject (String color, boolean filled) [
dateCreated - new java.util.Date();
1
Q
public String getColor() [
return color/
1
public void setColor (String color) [
this.color color;
1
dateCreated new java.util.Date();
public boolean isFilled() [
return filled;
1
this.color-color:
this filled - filled;
public void setFilled (boolean filled) [
this filled filled;
1
I
public java.util.Date getDateCreated () {
return dateCreated/
1
1
@Override
public String toString() [
return "created on " + dateCreated + "\ncolor: " + color +
"and filled: " + filled;
public void testoverriding() [
System.out.println("This is the testoverriding () method of the SimpleGeometricObject class");
34°F
Cloudy
task8D.java
▬▬
■
♡ ♡
*SimpleGeom... X square.java
Q Search
NO 1
↓
Writable
a
SquareTest.java
Smart Insert
overide.java
39:3:699
Triangle.java
TestTriangl...
84
4x O
a
2:38 PM
3/22/2023
X
岁 占 隐
25
鼎
2
a
@
B
Transcribed Image Text:➡ eclipse-workspace - project2/src/project2/SimpleGeometricObject.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help DH 0-2 -2 - #Ⓒ task8A.java task8C.java 2 95. 6 3 private String color "white"; 4 private boolean filled; $10 11 12 130 14 $15 16 17 18 19 20 21 22 23 24 256 26 27 28 29 30 $31 32 Re public SimpleGeometricObject() [ 33 34 356 37 39 40 41 42 846 reportsum6.java 47 48 49 51 852 package projectz; public class SimpleGeometricObject [ private java.util.Date dateCreated; 1 1 public SimpleGeometricObject (String color, boolean filled) [ dateCreated - new java.util.Date(); 1 Q public String getColor() [ return color/ 1 public void setColor (String color) [ this.color color; 1 dateCreated new java.util.Date(); public boolean isFilled() [ return filled; 1 this.color-color: this filled - filled; public void setFilled (boolean filled) [ this filled filled; 1 I public java.util.Date getDateCreated () { return dateCreated/ 1 1 @Override public String toString() [ return "created on " + dateCreated + "\ncolor: " + color + "and filled: " + filled; public void testoverriding() [ System.out.println("This is the testoverriding () method of the SimpleGeometricObject class"); 34°F Cloudy task8D.java ▬▬ ■ ♡ ♡ *SimpleGeom... X square.java Q Search NO 1 ↓ Writable a SquareTest.java Smart Insert overide.java 39:3:699 Triangle.java TestTriangl... 84 4x O a 2:38 PM 3/22/2023 X 岁 占 隐 25 鼎 2 a @ B
➡ eclipse-workspace - project2/src/project2/Triangle.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
2
95.
Q
private double height;
reportsum6.java
1 package project2;
2 public class Triangle extends Simple GeometricObject {
3 private double base;
5 public Triangle () {
€ super();
7 base = 5;
8 height = 10;
9
task8A.java
this.base= base;
13 this.height = height;
}
10 public Triangle (double base, double height) {
11 super();
12
19
}
20 public double getBase () {
21
return base;
#Ⓒ
task8C.java
22
}
23 public void setBase (double base) {
24
this.base = base;
25
}
26 public double getHeight () {
27
return height;
34°F
Cloudy
#
}
14
}
150 public Triangle (double base, double height, String color, boolean filled) {
16 super (color, filled);
17 this.base = base;
18 this.height = height;
28
}
29 public void setHeight (double height) {
30
this.height = height;
31
}
32 public double getArea() {
33
34
}
A35 public String toString() {
36
37
38 }
return 0.5 * base* height;
▼
task8D.java
▬▬
■
WD1
↓
*SimpleGeom...
Q Search
♡ ♡
square.java
return "Triangle with base = " + base + " and height = " + height + "\n" + super.toString();
Writable
SquareTest.java
a
Smart Insert
overide.java
17:18:412
Triangle.java X TestTriangl...
84
4x O
Q
2:37 PM
3/22/2023
X
* * * + @ 隐旦
8
%
鼎
2
凰
@
Transcribed Image Text:➡ eclipse-workspace - project2/src/project2/Triangle.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help 2 95. Q private double height; reportsum6.java 1 package project2; 2 public class Triangle extends Simple GeometricObject { 3 private double base; 5 public Triangle () { € super(); 7 base = 5; 8 height = 10; 9 task8A.java this.base= base; 13 this.height = height; } 10 public Triangle (double base, double height) { 11 super(); 12 19 } 20 public double getBase () { 21 return base; #Ⓒ task8C.java 22 } 23 public void setBase (double base) { 24 this.base = base; 25 } 26 public double getHeight () { 27 return height; 34°F Cloudy # } 14 } 150 public Triangle (double base, double height, String color, boolean filled) { 16 super (color, filled); 17 this.base = base; 18 this.height = height; 28 } 29 public void setHeight (double height) { 30 this.height = height; 31 } 32 public double getArea() { 33 34 } A35 public String toString() { 36 37 38 } return 0.5 * base* height; ▼ task8D.java ▬▬ ■ WD1 ↓ *SimpleGeom... Q Search ♡ ♡ square.java return "Triangle with base = " + base + " and height = " + height + "\n" + super.toString(); Writable SquareTest.java a Smart Insert overide.java 17:18:412 Triangle.java X TestTriangl... 84 4x O Q 2:37 PM 3/22/2023 X * * * + @ 隐旦 8 % 鼎 2 凰 @
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Developing computer interface
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education