Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Using the diagram as a reference, implement the following classes: Drug Painkiller Antibiotic The Drug class should have the following attributes: Attribute Type name

image text in transcribed
4. Using the diagram as a reference, implement the following classes: Drug Painkiller Antibiotic The Drug class should have the following attributes: Attribute Type name manufacturing_date expiration_date company name category dosage (mg) side effect String String String String String Integer String The class should also include the appropriate constructor and string methods to initialize and print the contents of each Drug instance, as well as accessor and mutator methods for each attribute. Add an attribute called contra_indications to the Painkiller class that inherits from Drug. This field is of type String, and holds the drugs that may conflict with the painkiller instance. As for the Antibiotic class, add an attribute called dosage_time of type int. You should override the __init_and_str_methods and add the appropriate accessors and mutators in Painkiller and Antibiotic classes in order to account for the new attributes. Create a test class to test all the above classes. Print all content of the variables using the str_methods. the the effects, Westen for Ir. It was then it was the 2018. The state of in

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions