Program 20 - Inheritance 15.1 (The Triangle class) Design a class named Triangle that extends Geometricobject. The class

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Program 20 - Inheritance 15.1 (The Triangle class) Design a class named Triangle that extends Geometricobject. The class

Post by answerhappygod »

Program 20 Inheritance 15 1 The Triangle Class Design A Class Named Triangle That Extends Geometricobject The Class 1
Program 20 Inheritance 15 1 The Triangle Class Design A Class Named Triangle That Extends Geometricobject The Class 1 (217.53 KiB) Viewed 63 times
Program 20 - Inheritance 15.1 (The Triangle class) Design a class named Triangle that extends Geometricobject. The class contains the following: • Three double data fields named sidel, side2, and side 3 to denote three sides of the triangle. • A no-arg constructor that creates a default triangle with each side 1.0. • A constructor that creates a triangle with the specified side1, side2, and side3. • The constant accessor functions for all three data fields. • A constant function named getArea() that returns the area of this triangle. • A constant function named getPerimeter() that returns the perimeter of this triangle. Draw the UML diagram that involves the classes Triangle and Geometricobject. Implement the class. Write a test program that prompts the user to enter three sides of the triangle, enter a color, and enter 1 or 0 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 filled or not. 다
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply