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
icon
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"; }
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
steps

Step by step

Solved in 4 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education