Assume there is a need to design a stock-control program for drugs used due toCOVID-19 pandemic at EMU. Write C++ code to create emudrugstore class and main( ) function using given specifications.   emudrugstore Data members: drug serial number (long), drug name (string), drug price (double), drug serial number counter (static long - Initial value should be 100), total drug counter (static integer - Initial value should be 0), total drug price (static double - Initial value should be 0.0) Methods: emudrugstore(string= “ “, double=0.0) //drug name and price must have default values emudrugstore(const drugstore &) ~emudrugstore( )   Read the instructions given below: Whenever a new object is created (this means; whenever anyconstructor is executed) ; compiler should assign a unique value for drug serial number, totaldrugprice should be increased by drug pricevalue, totaldrug counter should be increased by 1. Destructor prints an appropriate message on screen when the object is destroyed. (i.e: “Panadol (dname) object has been destroyed”) Do not forget to initialize all static data members.   Additionally do the followingsteps to complete “emudrugstore” class; Getter methodsfor every static and non-static members should be created. Remember that getter methods return the corresponding data member. Setter methods should be friendfunctionsof emudrugstore class. Therefore for every non-static member,create setter method using friend function Remember that setter methods receive a parameter and change the corresponding data member. USEthis pointerinyour class! Write a C++ code to create emudrugstore class (h) using the specifications provided above.Use appropriate (preferably short) names for data members and methods. Write a complete C++ code that will include the following steps to create main function(cpp). Include necessary header files, Create a dynamic object that will execute the default constructor, Create another dynamic object that will execute the parameterized constructor, Create a dynamic array object which stores data for 30 drugs, Call necessary method(s) to set a new drug name for dobj1 object, (ex: panadol) to change the drug price of second dynamic object to 20.18, to change the drug name of the object that is in the 3rd location of the array, (pass any drug name you want), to display the drug serial number and the drug name of the object that is in the 5th location of the array, to display drug name, drug price and drug serial number of the dynamic array object in row-wise, to display the current values of total drug count and total drug price, Delete all objects you have created.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
  1. Assume there is a need to design a stock-control program for drugs used due toCOVID-19 pandemic at EMU. Write C++ code to create emudrugstore class and main( ) function using given specifications.

 

emudrugstore

Data members:

drug serial number (long),

drug name (string),

drug price (double),

drug serial number counter (static long - Initial value should be 100),

total drug counter (static integer - Initial value should be 0),

total drug price (static double - Initial value should be 0.0)

Methods:

emudrugstore(string= “ “, double=0.0) //drug name and price must have default values

emudrugstore(const drugstore &)

~emudrugstore( )

 

Read the instructions given below:

  • Whenever a new object is created (this means; whenever anyconstructor is executed) ;
    • compiler should assign a unique value for drug serial number,
    • totaldrugprice should be increased by drug pricevalue,
    • totaldrug counter should be increased by 1.
  • Destructor prints an appropriate message on screen when the object is destroyed. (i.e: “Panadol (dname) object has been destroyed”)
  • Do not forget to initialize all static data members.

 

Additionally do the followingsteps to complete “emudrugstore” class;

  • Getter methodsfor every static and non-static members should be created. Remember that getter methods return the corresponding data member.
  • Setter methods should be friendfunctionsof emudrugstore class. Therefore for every non-static member,create setter method using friend function Remember that setter methods receive a parameter and change the corresponding data member.

USEthis pointerinyour class!

  1. Write a C++ code to create emudrugstore class (h) using the specifications provided above.Use appropriate (preferably short) names for data members and methods.
  2. Write a complete C++ code that will include the following steps to create main function(cpp).
  • Include necessary header files,
  • Create a dynamic object that will execute the default constructor,
  • Create another dynamic object that will execute the parameterized constructor,
  • Create a dynamic array object which stores data for 30 drugs,
  • Call necessary method(s)
    • to set a new drug name for dobj1 object, (ex: panadol)
    • to change the drug price of second dynamic object to 20.18,
    • to change the drug name of the object that is in the 3rd location of the array, (pass any drug name you want),
    • to display the drug serial number and the drug name of the object that is in the 5th location of the array,
    • to display drug name, drug price and drug serial number of the dynamic array object in row-wise,
    • to display the current values of total drug count and total drug price,
  • Delete all objects you have created.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY