Design a class named Triangle that extends GeometricObject. The 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
? 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 formula for computing the area of a triangle is
The toString() method is implemented as follows:
return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;
Implement the classes. Write a test program that prompts 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 filled properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not.?
NOTE: When entering numbers using a scanner, the newline character is left in the stream. So if you try to enter a string after you enter a number, it appears to skip over it because the string gets the newline character.?
You need to consume the newline character after you have entered numbers like this on a line be itself:
When entering numbers, the newline character is skipped so you don?t have to get rid of it before you enter the next number.
I am attaching pictures on what the output should look like.?
This question was answered on: Sep 18, 2020
Buy this answer for only: $15
This attachment is locked
We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)
Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
About this QuestionSTATUS
Sep 18, 2020EXPERT
GET INSTANT HELP/h4>
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions:
- As a reference for in-depth understanding of the subject.
- As a source of ideas / reasoning for your own research (if properly referenced)
- For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
NEW ASSIGNMENT HELP?
Order New Solution. Quick Turnaround
Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.
WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.