Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java code

Brandon91
Brandon91 


Triangle class.. I need a program code that promopts the user to enter three sides of the triangle, a color, and a boolean value to indicate whether the triangle is filled. The program should create a triangle object with these sides and set the color and filld properties using the input. program should display the area, perimeter, color, and true and false.. Attachments
Tags Clarifications

Answers

Java Code for Trianlge

uetian_cute
uetian_cute 



Complete code for problem with an attached screenshot of output Attachments
Triangle.zip (33 K) Download






Preview
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()

Preview
triangle.setFilled(fill); triangle.setColor(color); System.out.println("The Triangle Sides are \n side 1: " + triangle.getSide1() + "\n Side 2: " + triangle.getSide2() + "\n Side 3: " + triangle.getSide3()); System.out.println("The Triangle's Area is " + triangle.getArea()); System.out.println("The Triangle's Perimeter is " + triangle.getPerimeter());

Preview
void setSide1(double side1) { this.side1 = side1; } public void setSide2(double side2) { this.side2 = side2; } public void setSide3(double side3) { this.side3 = side2; } public double getArea() { int p = (int) (getPerimeter() / 2);

Preview

Screenshots
Screenshot
Purchase Answer

Program - As discussed

SW_wizard
SW_wizard 



Triangle program Attachments
triangle.zip (1 K) Download
Preview
boolean filled, double side1, double side2, double side3) { this.color = color; this.filled = filled; this.side1 = side1; this.side2 = side2; this.side3 = side3; } // Accessor to get color public String getColor() { return color; }

Screenshots
Purchase Answer

Triangle Program

sudheer488
sudheer488 



Triangle class.. I need a program code that promopts the user to enter three sides of the triangle, a color, and a boolean value to indicate whether the triangle is filled. The program should create a triangle object with these sides and set the color and filld properties using the input. program should display the area, perimeter, color, and true and false.. Attachments
Triangle.java (1 K) Download Preview
side1; this.side2 = side2; this.side3 = side3; } public double setSide1() { return side1; } public double setSide2() { return side2; } public double setSide3() { return side3; } public void setSide1(double side1)

TestTriangle.java (1 K) Download Preview
into theTriangle? System.out.println("The Triangle Sides are \n side 1: " + side1 + "\n Side 2: " + side2 + "\n Side 3: " + side3); System.out.println("The Triangle's Area is " + (side1 + side2 + side3) / 2); System.out.println("The Triangle's Perimeter is " +

GeomatricObject.java (1 K) Download Preview
} 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

Screenshots
Purchase Answer