Question
Triangle Project (JAVA) Create a New Java Project called YourLastNameInheritance. Design a class named Triangle that extends the GeometricObject class. The UML diagram for the
Triangle Project (JAVA) Create a New Java Project called YourLastNameInheritance. Design a class named Triangle that extends the GeometricObject class. The UML diagram for the GeometricObject class is provided below. GeometricObject -color : String -filled : Boolean -dateCreated : java.util.Date +GeometricObject() +getColor() : String +setColor(color : String) : void +isFilled() : Boolean +setFilled(filled : Boolean) : void +getDateCreated() : java.util.Date +toString() : String The Triangle class contains: Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. A no-arg constructor that creates a default triangle. A constructor that creates a triangle with the specified side1, side2, and side3. The accessor methods for all three data fields. A method named getArea() that returns the area of this triangle. A method named getPerimeter() that returns the perimeter of this triangle. A method named toString() that returns a string description for the triangle. The toString() method is implemented as follows: return "Triangle: side` = " + side1 + " side2 = " + side2 + " side3 = " + side3; Once you have written the classes, use it in an application that creates a Triangle object and asks the user to enter the values of the sides, the triangle's color, and whether or not it is filled. Then display the lengths of each side, along with the area, perimeter, color, and whether filled or not. Input Validation: Do not accept unreasonable/junk values, or negative values, which must be rejected and asked for another one. NOTE: Each class should be defined in its own class file. Please provide a sample of the input and output of the working program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started