Computer Science, asked by JOELJESHURUN, 3 months ago

Define a class Triangle with the following specifications :
Instance variables:-
int a, int b ,int c ,int sum : Stores the three angles of a triangle.
Member functions:-
Triangle() : initializes data members to default values.
void accept() : accepts the angles for the triangle from user.
void typetri() : Calculates the sum of all 3 angles and prints the type of
Triangle based on the given criteria.
Criteria Type of Triangle
All angles less than 90o Acute Triangle
Any one angle is 90o Right angle Triangle
Any one angle above 90o Obtuse Triangle
void display() : Prints the 3 angles, sum of all angles and type of Triangle
Write the main() , create object and invoke the methods.​

Answers

Answered by Alzafriya
0

Answer:

The GeometricObject

public class GeometricObject {

private String color = " white ";

private boolean filled;

private java.util.Date dateCreated;

public GeometricObject() {

dateCreated = new java.util.Date();

}

public GeometricObject(String color, boolean filled) {

dateCreated = new java.util.Date();

this.color = color;

this.filled = filled;

}

public String getColor() {

return color;

}

public void setColor(String color) {

this.color = color;

}

public boolean isFilled() {

return filled;

}

public void setFilled(boolean filled) {

this.filled = filled;

}

public java.util.Date getDateCreated() {

return dateCreated;

}

public String toString() {

return "Created on " + dateCreated + "\n color: " + color + " and filled ";

}

}

Similar questions