Make a C++ program that will compute for the area of a Triangle, Square, Rectangle, Ellipse, and Circle using Class. The variable area is private and of type float. Encapsulation is a must. showArea() can be used to return the computed area value coming from the different methods for area computation. Create 5 objects named a1 to a5. Use one area method for each object and show its corresponding area. You can give any value for the dimensions.
Make a C++ program that will compute for the area of a Triangle, Square, Rectangle, Ellipse, and Circle using Class. The variable area is private and of type float. Encapsulation is a must. showArea() can be used to return the computed area value coming from the different methods for area computation. Create 5 objects named a1 to a5. Use one area method for each object and show its corresponding area. You can give any value for the dimensions.
Chapter8: Arrays
Section: Chapter Questions
Problem 1CP
Related questions
Question
Make a C++ program that will compute for the area of a Triangle, Square, Rectangle, Ellipse, and Circle using Class.
The variable area is private and of type float.
Encapsulation is a must.
showArea() can be used to return the computed area value coming from the different methods for area computation.
Create 5 objects named a1 to a5.
Use one area method for each object and show its corresponding area.
You can give any value for the dimensions.
No input is needed.
Output should be:
The area of the triangle is 6.00000.
The area of the square is 25.00000.
The area of the rectangle is 6.00000.
The area of the ellipse is 18.84956.
The area of the circle is 28.27433.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning