For this question you will be implementing an inheritance-based system for medical drugs. The base class is called drugs it consists of two variables: category (string), date_of_manufacturing (string) and has two methods enter_drug_details () that sets the drug variables (setting) and show_drug_details () that prints the variables (printing). The first inheriting class is called MuseleRelaxer; its private data members are: tablet_name (string), dosage (int) and price_per_dosage (int); the class has following functions: enter_tablet_details () show_tablet_details () caleulate_price () /Prompts for input of tablet details /Prints tablet details /Calculates total price for tablet per volume Another class PainReliever inherits drugs class, it has variables: use_within_days (int), and following functions:
For this question you will be implementing an inheritance-based system for medical drugs. The base class is called drugs it consists of two variables: category (string), date_of_manufacturing (string) and has two methods enter_drug_details () that sets the drug variables (setting) and show_drug_details () that prints the variables (printing). The first inheriting class is called MuseleRelaxer; its private data members are: tablet_name (string), dosage (int) and price_per_dosage (int); the class has following functions: enter_tablet_details () show_tablet_details () caleulate_price () /Prompts for input of tablet details /Prints tablet details /Calculates total price for tablet per volume Another class PainReliever inherits drugs class, it has variables: use_within_days (int), and following functions:
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Hey can anyone please help me solve this question?
![Estimated time: 50 minutes
For this question you will be implementing an inheritance-based system for medical
drugs. The base class is called drugs it consists of two variables: category (string).
date_of_manufacturing (string) and has two methods enter_drug_details () that sets
the drug variables (setting) and show_drug_details () that prints the variables (printing).
The first inheriting class is called MuseleRelaxer; its private data members are:
tablet_name (string), dosage (int) and price_per_dosage (int): the class has following
functions:
enter_tablet_details ()
show_tablet_details ()
caleulate_price ()
/Prompts for input of tablet details
//Prints tablet details
/Calculates total price for tablet per volume
Another class PainReliever inherits drugs class, it has variables: use_within_days (int),
and following functions:
enter_reliever_details () /Prompts for input of PainReliever details
show_reliever_details () /Prints PainReliever details
check_Expiry ()
checks if the PainReliever has expired based on the date_of_manufacturing and
use_within_days variable.
I/This function takes as input the current date and
Note: The setter function of each inheriting class should call the setting function of its
base class, the same for printing function. You can use the std:stoi function to convert
string to integer. The format of the date is dd-mm. Don't care about the year. Use the
main function below:
void main() {
MuscleRelaxer mr;
mr.enter_tablet_details():
mr.show_tablet_details):
cout << "Price for the Muscle Relaxer:'< mr.calculate_price():
PainReliever pr;
pr.enter_reliever_details();
pr.show_reliever_details():
pr.check_expiry('15-05")? cout << endl << "Expired" : cout << endl <<
"Not-Expired"; }](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3e634767-d80e-4016-a32d-ec2d5c50fdda%2F77f0f442-9751-46fc-8973-fd5cef9ea2ae%2Fe78zivm_processed.png&w=3840&q=75)
Transcribed Image Text:Estimated time: 50 minutes
For this question you will be implementing an inheritance-based system for medical
drugs. The base class is called drugs it consists of two variables: category (string).
date_of_manufacturing (string) and has two methods enter_drug_details () that sets
the drug variables (setting) and show_drug_details () that prints the variables (printing).
The first inheriting class is called MuseleRelaxer; its private data members are:
tablet_name (string), dosage (int) and price_per_dosage (int): the class has following
functions:
enter_tablet_details ()
show_tablet_details ()
caleulate_price ()
/Prompts for input of tablet details
//Prints tablet details
/Calculates total price for tablet per volume
Another class PainReliever inherits drugs class, it has variables: use_within_days (int),
and following functions:
enter_reliever_details () /Prompts for input of PainReliever details
show_reliever_details () /Prints PainReliever details
check_Expiry ()
checks if the PainReliever has expired based on the date_of_manufacturing and
use_within_days variable.
I/This function takes as input the current date and
Note: The setter function of each inheriting class should call the setting function of its
base class, the same for printing function. You can use the std:stoi function to convert
string to integer. The format of the date is dd-mm. Don't care about the year. Use the
main function below:
void main() {
MuscleRelaxer mr;
mr.enter_tablet_details():
mr.show_tablet_details):
cout << "Price for the Muscle Relaxer:'< mr.calculate_price():
PainReliever pr;
pr.enter_reliever_details();
pr.show_reliever_details():
pr.check_expiry('15-05")? cout << endl << "Expired" : cout << endl <<
"Not-Expired"; }
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education