1. Write a class declaration named Circle with a private member variable named radius. Write set and get functions to ac

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: 899603
Joined: Mon Aug 02, 2021 8:13 am

1. Write a class declaration named Circle with a private member variable named radius. Write set and get functions to ac

Post by answerhappygod »

1. Write a class declaration named Circle with a private member
variable named
radius. Write set and get functions to access the radius variable,
and a function
named getArea that returns the area of the circle. The area is
calculated as
3.14159 * radius * radius
2- Add a default constructor to the Circle class in question
(1). The constructor should
initialize the radius member to 0.
3. Add an overloaded constructor to the Circle class in question
(2). The constructor
should accept an argument and assign its value to the radius member
variable.
4. Write a statement that defines an array of five objects of
the Circle class in question
(3). Let the default constructor execute for each element of the
array.
5. Write a statement that defines an array of five objects of
the Circle class in question
(3). Pass the following arguments to the elements’ constructor: 12,
7, 9, 14, and 8.
6. Write a for loop that displays the radius and area of the
circles represented by the
array you defined in question (5).
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply