ABC Blood bank wished to welcome and thank all their eligible donors as a symbol of respect. Write a C++ program to welcome and thank all their eligible donors using an explicit call destructor. Strictly adhere to the Object-Oriented Specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Donor has the following public data members. Data Type string Variable Name name age height weight no_of_units_donated int float float int Create a default constructor to display the message "Welcome to the Blood Bank". Check if the donor is eligible to donate the blood using a destructor. • If the age of the donor is above 18 years, then he is eligible, so display the message "Thank you for donating the Blood". • If the age of the donor is less than or equal to 18 years, then he is not eligible, so display the message "You are not eligible to donate the blood". Include the following member function in Donor class Description This method must display the donor details. Display the statement 'Donor details:' inside this method. Member Function void display() In the main method, get the donor details, display the details of the donor by calling display method ane display whether he is eligible or not using destructor.

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 6E
icon
Related questions
Question

1) QUESTION PROVIDED IN ATTACH IMAGE KINDLY SEE.

2) IF THERE IS A DECIMAL IN OUTPUT WHETHER IT'S ZERO OR TWO PLACE DECIMAL YOU MUST MATCH AS IT IS WITH QUESTION OUTPUT NO MISMATCH IN OUTPUT ACCEPTED

 

AND BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , donor.cpp  )

----------------- TEMPLATES BELOW FOR SOLUTION -----------------------

 

Main.cpp

#include<iostream>
#include<stdlib.h>
#include "Donor.cpp"
using namespace std;

int main()
{

Donor d;
cout<<"Enter the donor details\n";
cout<<"Enter the Name :\n";
cin>>d.name;
cout<<"Enter the Age :\n";
cin>>d.age;
cout<<"Enter the height :\n";
cin>>d.height;
cout<<"Enter the weight :\n";
cin>>d.weight;
cout<<"Enter the No of units to be donated :\n";
cin>>d.no_of_units_donated;
//Fill your code here
return 0;
}

 

 

Donor.cpp

 

#include<iostream>
#include<stdlib.h>
using namespace std;

class Donor
{

public:
string name;
int age;
float height;
float weight;
int no_of_units_donated;
Donor()
{
//Fill your code here
}

~Donor()
{
//Fill your code here
}


void display()
{
//Fill your code here

}

};

 

ABC Blood bank wished to welcome and thank all their eligible donors as a symbol of respect.
Write a C++ program to welcome and thank all their eligible donors using an explicit call destructor.
Strictly adhere to the Object-Oriented Specifications given in the problem statement. All class
names, member variable names, and function names should be the same as specified in the problem
statement.
The class Donor has the following public data members.
Data Type
string
int
float
Variable Name
name
age
height
weight
no_of_units_donated
float
int
Create a default constructor to display the message "Welcome to the Blood Bank".
Check if the donor is eligible to donate the blood using a destructor.
• If the age of the donor is above 18 years, then he is eligible, so display the message "Thank you for
donating the Blood".
• If the age of the donor is less than or equal to 18 years, then he is not eligible, so display the message
"You are not eligible to donate the blood".
Include the following member function in Donor class
Member Function
Description
void display()
This method must display the donor details.
Display the statement 'Donor details:' inside this method.
In the main method, get the donor details, display the details of the donor by calling display method and
display whether he is eligible or not using destructor.
Input and Output Format:
Refer to the sample input and output for formatting specifications.
[All text in bold are input and the remaining are output]
Sample Input and Output 1:
Welcome to the Blood Bank
Enter the donor details
Enter the Name:
Sowmi
Enter the Age :
22
Enter the height:
156.5
Enter the weight:
47
Enter the No of units to be donated:
1
Donor details:
Sowmi
22
156.5
47
1
Thank you for donating the Blood
Sample Input and Output 2:
Welcome to the Blood Bank
Enter the donor details
Enter the Name:
Aanie
Enter the Age:
4
Enter the height:
90.4
Enter the weight:
25
Enter the No of units to be donated:
1
Donor details:
Aanie
4
90.4
25
1
You are not eligible to donate the blood
Transcribed Image Text:ABC Blood bank wished to welcome and thank all their eligible donors as a symbol of respect. Write a C++ program to welcome and thank all their eligible donors using an explicit call destructor. Strictly adhere to the Object-Oriented Specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Donor has the following public data members. Data Type string int float Variable Name name age height weight no_of_units_donated float int Create a default constructor to display the message "Welcome to the Blood Bank". Check if the donor is eligible to donate the blood using a destructor. • If the age of the donor is above 18 years, then he is eligible, so display the message "Thank you for donating the Blood". • If the age of the donor is less than or equal to 18 years, then he is not eligible, so display the message "You are not eligible to donate the blood". Include the following member function in Donor class Member Function Description void display() This method must display the donor details. Display the statement 'Donor details:' inside this method. In the main method, get the donor details, display the details of the donor by calling display method and display whether he is eligible or not using destructor. Input and Output Format: Refer to the sample input and output for formatting specifications. [All text in bold are input and the remaining are output] Sample Input and Output 1: Welcome to the Blood Bank Enter the donor details Enter the Name: Sowmi Enter the Age : 22 Enter the height: 156.5 Enter the weight: 47 Enter the No of units to be donated: 1 Donor details: Sowmi 22 156.5 47 1 Thank you for donating the Blood Sample Input and Output 2: Welcome to the Blood Bank Enter the donor details Enter the Name: Aanie Enter the Age: 4 Enter the height: 90.4 Enter the weight: 25 Enter the No of units to be donated: 1 Donor details: Aanie 4 90.4 25 1 You are not eligible to donate the blood
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Table
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
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