Question: 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

 Note. Read through the whole of Question 4 below before you
attempt to answer the questions that follow Also, provide only the member

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 file 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 e7 Church St, Pretoria m 3 2 51 Caldy Pravin 39 Blue Water Bay, Durban +31 52 we expect the following output in file ExtraCareBabies dat Eleanor Witbooi 45 Blue Heaven Plats, Lavender Hall f 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 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

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!