an oop us
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
write an oop using photos below
![1)Write a member function named addDrug which accepts 3 parameters name, price, and quantity of a drug, then add it to the list
2) Write a member function named getDrug which accepts an integer parameter that represents the index (location) of the drug
then returns name and quantity of this drug from the specific location. (Remember: You should check the location if it is in the list
range or not. Otherwise, print "Out of range").
3) Write a member function named printAllHigher will accept a double parameter represents a price then, prints all drugs
name which prices are higher than the parameter.
4) Write a non-member function named largerPharmacy that takes 2 objects of type Pharmacy by reference and returns the
Pharmacy that contains number of drugs more than the other.
- The main is given to you.
Constraints
None
S Input Format
You must enter 3 drugs for the first pharmacy and 6 drugs for the second pharmacy (i.e. 9 string values for name,
9 double values for price, and 9 integer values for quantity)
followed by one double value
E Output Format
See the sample
O Sample #1
Input](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fed03b3d2-d0ae-4b9a-b925-0b8539b5af29%2F02c4e3e3-e5b4-45f1-8245-c0aa6d58f949%2F76dysbh_processed.png&w=3840&q=75)
Transcribed Image Text:1)Write a member function named addDrug which accepts 3 parameters name, price, and quantity of a drug, then add it to the list
2) Write a member function named getDrug which accepts an integer parameter that represents the index (location) of the drug
then returns name and quantity of this drug from the specific location. (Remember: You should check the location if it is in the list
range or not. Otherwise, print "Out of range").
3) Write a member function named printAllHigher will accept a double parameter represents a price then, prints all drugs
name which prices are higher than the parameter.
4) Write a non-member function named largerPharmacy that takes 2 objects of type Pharmacy by reference and returns the
Pharmacy that contains number of drugs more than the other.
- The main is given to you.
Constraints
None
S Input Format
You must enter 3 drugs for the first pharmacy and 6 drugs for the second pharmacy (i.e. 9 string values for name,
9 double values for price, and 9 integer values for quantity)
followed by one double value
E Output Format
See the sample
O Sample #1
Input
![Use the following UML class diagrams for Pharmacy class and Drug struct to Complete the Pharmacy class by
writing the implementation of the required functions outside the class interface.
Pharmacy
Drug
drugs [60]: Drug
name: string
length: int
//number of drugs
price: double
+ Pharmacy ()
quantity: int
+ isFull(): bool
+ isEmpyt (): bool
+ getNumDrugs () : int
+ printAllDrugs () : void
+ addDrug (string, double, int): void
+ getDrug (int,string&,int&): void
+ printAllHigher (double): void
+ -Pharmacy ()](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fed03b3d2-d0ae-4b9a-b925-0b8539b5af29%2F02c4e3e3-e5b4-45f1-8245-c0aa6d58f949%2F5scxh7m_processed.png&w=3840&q=75)
Transcribed Image Text:Use the following UML class diagrams for Pharmacy class and Drug struct to Complete the Pharmacy class by
writing the implementation of the required functions outside the class interface.
Pharmacy
Drug
drugs [60]: Drug
name: string
length: int
//number of drugs
price: double
+ Pharmacy ()
quantity: int
+ isFull(): bool
+ isEmpyt (): bool
+ getNumDrugs () : int
+ printAllDrugs () : void
+ addDrug (string, double, int): void
+ getDrug (int,string&,int&): void
+ printAllHigher (double): void
+ -Pharmacy ()
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 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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
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