Question: Write a class definition for a class called People with the following attributes and methods. Attributes must not be accessible from other classes directly. Attributes

 Write a class definition for a class called "People" with the

Write a class definition for a class called "People" with the following attributes and methods. Attributes must not be accessible from other classes directly. Attributes birth Year (int) height (double) weight (double) name (string) Methods calculateAge(int val):this method takes a single parameter as the current year, and find o the age of a person at that year. For example if the persons birth Year is 1980 and if this method is called with 2000 as a parameter, then this method should return 20. Calculate BMI():This method calculates body-mass index of a person according to formula of h/omega^2, where h and w is the height and weight of the person. Write getter/setter methods for all the attributes, write a single constructor which will get birth Year, height and weight at the time of initialization

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!