Question: Tells the user what the program does. Prompts the user to enter the values for the sides, color, and filled attribute for a triangle object.

  1. Tells the user what the program does.
  2. Prompts the user to enter the values for the sides, color, and filled attribute for a triangle object.
  3. Saves the users input.
  4. Using the values entered by the user, creates the Triangle object.
  5. Displays the string representation of the Triangle object by calling its toString( ) method. Look at the output example below to see what this output should look like.
  6. Displays a goodbye message.

The example below show what your program should look like when it runs (user input is in green).

This program gets input for a triangle from the user.
It then creates a Triangle object and displays its description.

Enter the color of the triangle (e.g. "red"):
red
Is the triangle filled (y or n):
y
Enter the non-zero, positive lengths of the three sides of the triangle:
3 4 5

Triangle Output:
side1 = 3.0, side2 = 4.0, side 3 = 5.0
created on Wed May 22 07:34:11 MDT 2019
color: red and filled = true
Area = 6.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!