g) Write statement to call method getArea using object crl.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 7SA: Assume the definition of class foodType as given in Exercise 6. Answer the following questions? (1,...
icon
Related questions
Question
e) Create an instance or object (cr1) of the class Circle
f) Write statement to access/call member method setRadius
using the object crl.
g) Write statement to call method getArea using object crl.
h) Write statement to call all member methods through the
object cr2.
Transcribed Image Text:e) Create an instance or object (cr1) of the class Circle f) Write statement to access/call member method setRadius using the object crl. g) Write statement to call method getArea using object crl. h) Write statement to call all member methods through the object cr2.
1. Analysis the following class definition e and answer the
following questions for the class definition
class Circle {
double
radius;
private double pi()
return 3.14;}
void setRadius(double x){
radius=x; }
double getArea(){
return pi()*radius*radius;}
double getCircum(){
return 2*pi()*radius;}
a) Class name is
b) Member variable(s):
variable(s)..
c) Is there any constructor in the class Circle?
Data type of member
If Yes, write name of the constructor and its
parameter..
d)
Member method
Return type Access
Parameters with data
Specifier
type
name
Transcribed Image Text:1. Analysis the following class definition e and answer the following questions for the class definition class Circle { double radius; private double pi() return 3.14;} void setRadius(double x){ radius=x; } double getArea(){ return pi()*radius*radius;} double getCircum(){ return 2*pi()*radius;} a) Class name is b) Member variable(s): variable(s).. c) Is there any constructor in the class Circle? Data type of member If Yes, write name of the constructor and its parameter.. d) Member method Return type Access Parameters with data Specifier type name
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning