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
icon
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
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 ()
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
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Encryption and Decryption
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.
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