Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Create a TestTriangle class in an individual .java file. In the main method,
(1) Create a Triangle object with default base and height values.
(2) Create a Triangle object with specified base = 3 and height =4.

[画像:➡ eclipse-workspace - project2/src/project2/Triangle.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help Q © 95. TestPrintPri... 1 package project2; 2 public class Triangle extends SimpleGeometricObject { 3 private double base; 4 private double height; 5 public Triangle() { € super(); 7 base= 5; reportsum6.java this.base= base; this.height = height; 19 } 20 public double getBase () { 21 return base; 22 } 23 public void setBase (double base) { 24 this.base = base; 25 } 26 public double getHeight () { 27 return height; 8 height = 10; 9 } 10 public Triangle (double base, double height) { 11 super(); 12 this.base = base; 13 this.height = height; 14 } 150 public Triangle (double base, double height, String color, boolean filled) { 16 super (color, filled); 17 18 } 32 public double getArea() { 33 34 task8A.java 28 } 29 public void setHeight (double height) { 30 this.height = height; 31 34°F Cloudy # } A35 public String toString() { 36 37 38 } } return 0.5 * base* height; task8C.java ▬▬ しかく NO 1 task8D.java Q Search return "Triangle with base = " + base + " and height = " + height + "\n" + super.toString(); SimpleGeome... Writable a P square.java SquareTest.java Smart Insert 17:18:412 overide.java Triangle.java X "83 Q 10:53 PM 3/21/2023 X * * * + @ 隐旦 8 % 鼎 凰 @]
expand button
Transcribed Image Text:➡ eclipse-workspace - project2/src/project2/Triangle.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help Q © 95. TestPrintPri... 1 package project2; 2 public class Triangle extends SimpleGeometricObject { 3 private double base; 4 private double height; 5 public Triangle() { € super(); 7 base= 5; reportsum6.java this.base= base; this.height = height; 19 } 20 public double getBase () { 21 return base; 22 } 23 public void setBase (double base) { 24 this.base = base; 25 } 26 public double getHeight () { 27 return height; 8 height = 10; 9 } 10 public Triangle (double base, double height) { 11 super(); 12 this.base = base; 13 this.height = height; 14 } 150 public Triangle (double base, double height, String color, boolean filled) { 16 super (color, filled); 17 18 } 32 public double getArea() { 33 34 task8A.java 28 } 29 public void setHeight (double height) { 30 this.height = height; 31 34°F Cloudy # } A35 public String toString() { 36 37 38 } } return 0.5 * base* height; task8C.java ▬▬ しかく NO 1 task8D.java Q Search return "Triangle with base = " + base + " and height = " + height + "\n" + super.toString(); SimpleGeome... Writable a P square.java SquareTest.java Smart Insert 17:18:412 overide.java Triangle.java X "83 Q 10:53 PM 3/21/2023 X * * * + @ 隐旦 8 % 鼎 凰 @
[画像:X b Answered: we are goin X ← → C ✰ liveexample.pearsoncmg.com/html/SimpleGeometricObject.html Lab 5: Inheritance Show Code With Line Numbers public class SimpleGeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; /** Construct a default geometric object */ public SimpleGeometricObject() { dateCreated new java.util.Date(); /** Construct a geometric object with the specified color and filled value */ public SimpleGeometricObject(String color, boolean filled) { dateCreated = new java.util.Date(); this.color= color; this filled filled; } /** Return color */ public String getColor() { return color; } /** Set a new color */ public void setColor (String color) { this.color= color; } /** 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; } /** Return a string representation of this object */ public String toString() { + return "created on dateCreated + "\ncolor: "+color+ and filled: " + filled; } 34°F Cloudy ▬▬ しかく Introduction to Java Pix Q Search Unit 7 AS1: Assignmer X a Files X G how do you zoom in cx | + Q Pa 0 10:53 PM 3/21/2023 X :]
expand button
Transcribed Image Text:X b Answered: we are goin X ← → C ✰ liveexample.pearsoncmg.com/html/SimpleGeometricObject.html Lab 5: Inheritance Show Code With Line Numbers public class SimpleGeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; /** Construct a default geometric object */ public SimpleGeometricObject() { dateCreated new java.util.Date(); /** Construct a geometric object with the specified color and filled value */ public SimpleGeometricObject(String color, boolean filled) { dateCreated = new java.util.Date(); this.color= color; this filled filled; } /** Return color */ public String getColor() { return color; } /** Set a new color */ public void setColor (String color) { this.color= color; } /** 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; } /** Return a string representation of this object */ public String toString() { + return "created on dateCreated + "\ncolor: "+color+ and filled: " + filled; } 34°F Cloudy ▬▬ しかく Introduction to Java Pix Q Search Unit 7 AS1: Assignmer X a Files X G how do you zoom in cx | + Q Pa 0 10:53 PM 3/21/2023 X :
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education