Write a C++ program that tells the eldest and youngest sibling in a family. Your code should include a class named as Sibling, having following private data members are name and age. Make array of objects by prompting the user, the number of siblings a family Then compare the ages of all the siblings and sort them in ascending or descending order and display the eldest and youngest sibling amongst the Write the Setter functions to set or assign values to all data members of a Class Sibling. Write the Getter functions to get value of all data members of a Class Sibling. Also write default and parameterized constructor for the class Sibling. Your output should be similar to the following: Please enter the number of siblings: 4   Please enter the particulars of each sibling: Please enter the particulars of Sibling: 1 Name:      Arif Age: 20   Please enter the particulars of Sibling: 2 Name:                Sana Age: 16   Please enter the particulars of Sibling: 3 Name:                Sobia Age: 13   Please enter the particulars of Sibling: 4 Name:                Amna Age: 10   Arif, having age 20 is the eldest sibling whereas Amna, having age 10 is the youngest.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question

Write a C++ program that tells the eldest and youngest sibling in a family. Your code should include a class named as Sibling, having following private data members are name and age.

  • Make array of objects by prompting the user, the number of siblings a family
  • Then compare the ages of all the siblings and sort them in ascending or descending order and display the eldest and youngest sibling amongst the
  • Write the Setter functions to set or assign values to all data members of a Class Sibling.
  • Write the Getter functions to get value of all data members of a Class Sibling.
  • Also write default and parameterized constructor for the class Sibling. Your output should be similar to the following:

Please enter the number of siblings: 4

 

Please enter the particulars of each sibling: Please enter the particulars of Sibling: 1 Name:      Arif

Age: 20

 

Please enter the particulars of Sibling: 2 Name:                Sana

Age: 16

 

Please enter the particulars of Sibling: 3 Name:                Sobia

Age: 13

 

Please enter the particulars of Sibling: 4 Name:                Amna

Age: 10

 

Arif, having age 20 is the eldest sibling whereas Amna, having age 10 is the youngest.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Reference Types in Function
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr