Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 2. This is a compulsory question related to OOP. You are required to provide an answer using complete C+ code. Write a C++ class

image text in transcribed
QUESTION 2. This is a compulsory question related to OOP. You are required to provide an answer using complete C+ code. Write a C++ class named Cone that consists of TWO float attributes, radius and slantHeight, by answering the following questions: a) Implement the following constructors: - An empty and parameter-less constructor. (2 marks) - A constructor that accepts as parameters the radius and slantheight attributes. (3 marks) b) Implement class functions that: - Allows a user to enter the code dimensions. (3 marks) - Calculate and return the volume of the cone [volume =4/3r2]. (3 marks) - Calculate and return the surface area of the cone (surface area =r(r+h2+r2). (3 marks) - Display all the information related to the cone namely the radius, slant height, volume, and surface area. ( 5 marks) c) Implement a "getter" and a "setter" for both attributes. (4 marks) d) Implement a main function that instantiates an instance of a Cone and then asks a user to input the required dimensions. The program should then display all the information related to the sphere on the screen by invoking the appropriate functions. (7 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

Students also viewed these Databases questions

Question

What are six characteristics of effective teams? [LO-1]

Answered: 1 week ago