Note. Read through the whole of Question 4 below before you attempt to answer the questions that follow Also, provide only the member functions requested and required by the question Welcome_to_the_World is a new maternity hospital that captures the following information for each baby born name, contact details, sex (male or female). weight, and length This information is collected in a file called Babies dat on a daily basis The average weight for a baby is 3 2 kg and the average length is 52 cm Welcome_to_the_World wants to check up regularly on babies smaller than that, ie weighing less than 3 2 kg and measuring less than 52 cm At the end of every day, a list of all smaller-than-average babies born, is copied to a file called ExtraCareBabies dat To assist Welcome_to_the_World in this process, write a program that reads the data for each baby from the file Babies dat, and determines which babies should receive extra care because they are smaller than average As an example of the record kept for a baby, baby Mpho Nkosi's address is 231 Nelson Drive, Soweto. he weighed 3 57kg at birth and was 53 cm long (see the first record in the data fide Babies dat) If Babies dat contains the following data Mpho Nkos. 231 Nelson Drive, Soweto - 3 57 53 Eleanor Witbooi 45 Blue Heaven Flats, Lavender Hall f 2 86 50 Jonathan Cleggerty 87 Church St, Pretoria m 3 2 51 Calay Pravin 39 Blue Water Bay, Durban +31 52 we expect the following output in file ExtraCareBabies dat Eleanor Witbooi 45 Blue Heaven Plats, Lavender Hill [ 2.86 50 To implement this program, define a class Baby that represents the data Welcome_to_the_World keeps for each baby This class has five member vanables name, a string that holds the name of the baby address, a strong that holds the address of the baby sex, a char vanable indicating the sex of the baby with an 'm for a boy and an 'f for a girl weight, a double value representing weight of the baby in kilograms . length, a double value rep 5 6 //5 Instantiate an object averageBaby using the 1/overloaded constructor and inatialising the weight for an average 1/baby to 3 2 kg and the length to 52 cm All other member variables 1/ should be instantiated to blank strings or characters while //6 Extract an object newBaby from file 1/babies dat 1 7/7 Compare object newBaby wath 1/ object averageBaby J/8 Output newBaby to file 1/ExtraCareBabies dat if necessary if ( 7 1 9 //9 Close files return 0. } 44 4 4 1 Write a statement to declare an array ourBabies of fifty Saby objects (1) 4 4 2 Assume nr Babies Baby objects are stored in array our Babies Use the array our Babies and write a program fragment to display the names of all male babies in the array (3) QUESTION 5 [15] Consider the class specification (interface) for the class insurance pol.cy below class Insurance policy + public Insurance policy(). Insurance Policy (int pnr, string pholder, douple aRate). void snowPolicy (ostream & Out) const, void set Policyant pNe, string pholder, double aRate). unt get_pr)coast. string get_pholder () const. double get_aRate() const, private int policyNr. string policyholder. double annual Rate. } 51 Define a new class CarInsurance that inhents the functionality of the class Insurance policy The class CarInsurance has additional member vanable, excess. Class an we expect the following output in file ExtraCareBabies dat Eleanor Witbooi 45 Blue Heaven Plats, Lavender Hall 1 2.86 50 To implement this program, define a class Baby that represents the data Welcome_to_the_World keeps for each baby This class has five member vanables naine, a string that holds the name of the baby address, a string that holds the address of the baby sex, a char variable indicating the sex of the baby with an 'm' for a boy and an 't for a girl weight, a double value representing weight of the baby in kilograms length, a double value representing tength of the baby in centimetres In addition, the class should have the following member functions A default constructor that initializes the data members name and address to empty stangs, sex to an empty character and weight and length to 0 An overloaded constructor that sets name, address, sex, we ght and length to specified values A destructor that does not perform any action Accessor functions to return the baby's sex member and name An overloaded comparison operators to compare two Baby objects The overloaded comparison operator>(implemented as a friend function) so that it can be used to input values of type Baby An overloaded stream insertion operator 1/1. Include files needed using namespace std; int main() 1 2 1/2 Declare input file, open fale Babies.dat and //check that file exists 1/3. Declare output file, open file //ExtraCare Babies dat and check that file exista 3 Note. Read through the whole of Question 4 below before you attempt to answer the questions that follow Also, provide only the member functions requested and required by the question Welcome_to_the_World is a new maternity hospital that captures the following information for each baby born name, contact details, sex (male or female). weight, and length This information is collected in a file called Babies dat on a daily basis The average weight for a baby is 3 2 kg and the average length is 52 cm Welcome_to_the_World wants to check up regularly on babies smaller than that, ie weighing less than 3 2 kg and measuring less than 52 cm At the end of every day, a list of all smaller-than-average babies born, is copied to a file called ExtraCareBabies dat To assist Welcome_to_the_World in this process, write a program that reads the data for each baby from the file Babies dat, and determines which babies should receive extra care because they are smaller than average As an example of the record kept for a baby, baby Mpho Nkosi's address is 231 Nelson Drive, Soweto. he weighed 3 57kg at birth and was 53 cm long (see the first record in the data fide Babies dat) If Babies dat contains the following data Mpho Nkos. 231 Nelson Drive, Soweto - 3 57 53 Eleanor Witbooi 45 Blue Heaven Flats, Lavender Hall f 2 86 50 Jonathan Cleggerty 87 Church St, Pretoria m 3 2 51 Calay Pravin 39 Blue Water Bay, Durban +31 52 we expect the following output in file ExtraCareBabies dat Eleanor Witbooi 45 Blue Heaven Plats, Lavender Hill [ 2.86 50 To implement this program, define a class Baby that represents the data Welcome_to_the_World keeps for each baby This class has five member vanables name, a string that holds the name of the baby address, a strong that holds the address of the baby sex, a char vanable indicating the sex of the baby with an 'm for a boy and an 'f for a girl weight, a double value representing weight of the baby in kilograms . length, a double value rep 5 6 //5 Instantiate an object averageBaby using the 1/overloaded constructor and inatialising the weight for an average 1/baby to 3 2 kg and the length to 52 cm All other member variables 1/ should be instantiated to blank strings or characters while //6 Extract an object newBaby from file 1/babies dat 1 7/7 Compare object newBaby wath 1/ object averageBaby J/8 Output newBaby to file 1/ExtraCareBabies dat if necessary if ( 7 1 9 //9 Close files return 0. } 44 4 4 1 Write a statement to declare an array ourBabies of fifty Saby objects (1) 4 4 2 Assume nr Babies Baby objects are stored in array our Babies Use the array our Babies and write a program fragment to display the names of all male babies in the array (3) QUESTION 5 [15] Consider the class specification (interface) for the class insurance pol.cy below class Insurance policy + public Insurance policy(). Insurance Policy (int pnr, string pholder, douple aRate). void snowPolicy (ostream & Out) const, void set Policyant pNe, string pholder, double aRate). unt get_pr)coast. string get_pholder () const. double get_aRate() const, private int policyNr. string policyholder. double annual Rate. } 51 Define a new class CarInsurance that inhents the functionality of the class Insurance policy The class CarInsurance has additional member vanable, excess. Class an we expect the following output in file ExtraCareBabies dat Eleanor Witbooi 45 Blue Heaven Plats, Lavender Hall 1 2.86 50 To implement this program, define a class Baby that represents the data Welcome_to_the_World keeps for each baby This class has five member vanables naine, a string that holds the name of the baby address, a string that holds the address of the baby sex, a char variable indicating the sex of the baby with an 'm' for a boy and an 't for a girl weight, a double value representing weight of the baby in kilograms length, a double value representing tength of the baby in centimetres In addition, the class should have the following member functions A default constructor that initializes the data members name and address to empty stangs, sex to an empty character and weight and length to 0 An overloaded constructor that sets name, address, sex, we ght and length to specified values A destructor that does not perform any action Accessor functions to return the baby's sex member and name An overloaded comparison operators to compare two Baby objects The overloaded comparison operator>(implemented as a friend function) so that it can be used to input values of type Baby An overloaded stream insertion operator 1/1. Include files needed using namespace std; int main() 1 2 1/2 Declare input file, open fale Babies.dat and //check that file exists 1/3. Declare output file, open file //ExtraCare Babies dat and check that file exista 3