In the main method of the TestTriangle class, make the two Triangle objects that you created in Task 2 call the testOverriding () method. Ensure it runs without errors below is the TestTrangle code not in pictures package project2; public class TestTriangle { public static void main(String[] args) { Triangle triangle1 = new Triangle(); System.out.println("Triangle 1:"+triangle1); Triangle triangle2 = new Triangle(3, 4); System.out.println("Triangle 2:"+triangle2); } }
In the main method of the TestTriangle class, make the two Triangle objects that you created in Task 2 call the testOverriding () method. Ensure it runs without errors below is the TestTrangle code not in pictures package project2; public class TestTriangle { public static void main(String[] args) { Triangle triangle1 = new Triangle(); System.out.println("Triangle 1:"+triangle1); Triangle triangle2 = new Triangle(3, 4); System.out.println("Triangle 2:"+triangle2); } }
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
Related questions
Question
In the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the testOverriding () method.
Ensure it runs without errors
below is the TestTrangle code not in pictures
package project2;
public class TestTriangle {
public static void main(String[] args) {
Triangle triangle1 = new Triangle();
System.out.println("Triangle 1:"+triangle1);
Triangle triangle2 = new Triangle(3, 4);
System.out.println("Triangle 2:"+triangle2);
}
}

Transcribed Image Text:➡ eclipse-workspace - project2/src/project2/Triangle.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
Q
©
2
25
task8A.java
1 package project2;
2 class Triangle extends SimpleGeometricObject (
6
7
8
106
11
12
13
14
150
16
17
18
19
200
21
22
23
24
25
26
27
28
29
30
31
32
3.3
35
A360
37
38
A390
40
41
42 1
private double base;
private double height;
public Triangle() [
task8B.java
aupar();
base-5;
height-10;
1
public Triangle (double base, double height) {
aupar();
this.base-base;
this.height = height/
1
public double getBase() [
1
public Triangle (double base, double height, String color, boolean filled) [
aupar (color, filled);
this.base-base;
this.height-height:
1
public void setBase (double base) {
this.base-base;
return base;
1
public double getHeight()
[
1
task8C.java
34°F
Cloudy
return height;
1
public void setHeight (double height) {
this.height-height;
1
public double getArea() [
raturn 0.5*base height;
1
public void testoverriding () |
System.out.println("This is the overridden testoverriding() method");
task8D.java
1
public String toString() [
return "Triangle with base = " + base + " and height = " + height + "\n" + supar.toString();
▬▬
■
D1
Q Search
SimpleGeome...
square.java
Writable
SquareTest.java
a
overide.java
Smart Insert
Triangle.java X TestTriangl...
1:1:0
I
>>
84
1x
Q
2
6:59 PM
3/22/2023
X
8
%
* ©I
鼎
@
凰

Transcribed Image Text:➡ eclipse-workspace - project2/src/project2/SimpleGeometricObject.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
-2-2# G
task8C.java
25
2
3
4
task8A.java
private String color "white";
private boolean filled;
5 private java.util.Date dateCreated;
6
10
11
12
13
BO public SimpleGeometricObject() [
9
14
15
16
17
18
19
200
21
22
23
24
25Ⓒ
26
27
28
29
30
31
32
33
3.5Ⓒ
36
37
38
39
40
41
842
45
46
47
48
50
51
52
53
package projectz;
public class SimpleCeometricObject [
1
1
1
public SimpleGeometricObject (String color, boolean filled) [
dateCreated - new java.util.Date();
this.color - color;
this filled filled;
1
public String getColor() [
return color;
1
public void setColor (String color) [
this.color color;
task8B.java
1
public boolean isFilled() [
return filled/
1
dateCreated new java.util.Date();
public void setFilled (boolean filled) [
this filled-filled;
1
public java.util.Date getDateCreated ()
return dateCreated/
1
1
@Override
public String toString() [
return "created on " + dateCreated + "\ncolor: "+color+
"and filled: " + filled;
4
public void testoverriding() [
System.out.println("This is the testoverriding () method of the SimpleGeometricObject class");
34°F
Cloudy
task8D.java
▬▬
■
NO 1
Q Search
↓ 줘
SimpleGeome... Xsquare.java
Writable
SquareTest.java
a
overide.java
Smart Insert
Triangle.java
42:4:773
I
TestTriangl...
>>
84
1x
a
Line: 20
6:59 PM
3/22/2023
X
* * @旦
25
鼎
@a
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

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

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education