Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3) Write a test application named Exam Test of options as shown in the sample output Choice 1: Ask the user to enter the medici

image text in transcribedimage text in transcribed

3) Write a test application named Exam Test of options as shown in the sample output Choice 1: Ask the user to enter the medici method returns false, display an error mes Choice 2: Call method print Choice 3: Ask the user to enter the Medici the result Choice 4: Call method sumItems and pri Choice 5: Call method average and print the result. Choice 6: Exit the program. Sample Output Please enter the pharmacy name Royal pharmacy Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 1 Enter the medicine name: Panadol Enter the total items: 5 Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 1 Enter the medicine name: Augmantine Enter the total items: 10 Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 2) class PharmacyStack that includes the following instance variables: private Medicine top; private String pharmacyName; private int numOfOrder; The class should have the following methods: A constructor that initializes the market name pharmacyName and sets num OfOrder to 0. public boolean push(String name, int items) Modify the given push method to increment numOfOrder by 1, creates a Medicine using numOfOrder as the medID and adds a Medicine in the stack. public void print() The method is given in the attached file. Do not make any changes to the method. private void push() The method is given in the attached file. Do not make any changes to the method. public Medicine popo The method is given in the attached file. Do not make any changes to the method. public int stackSize() Counts how many medicines are in stack. Returns the count. public int sumItems() Returns the sum of the totalItems in the stack. public double average() Calculates the average of the totalItems in the stack and returns its value. 3) Write a test application named Exam Test of options as shown in the sample output Choice 1: Ask the user to enter the medici method returns false, display an error mes Choice 2: Call method print Choice 3: Ask the user to enter the Medici the result Choice 4: Call method sumItems and pri Choice 5: Call method average and print the result. Choice 6: Exit the program. Sample Output Please enter the pharmacy name Royal pharmacy Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 1 Enter the medicine name: Panadol Enter the total items: 5 Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 1 Enter the medicine name: Augmantine Enter the total items: 10 Choose: 1. Add a Medicine 2. Print all Medicines 3. Find stack size 4. Sum of items 5. Find average 6. Exit 2) class PharmacyStack that includes the following instance variables: private Medicine top; private String pharmacyName; private int numOfOrder; The class should have the following methods: A constructor that initializes the market name pharmacyName and sets num OfOrder to 0. public boolean push(String name, int items) Modify the given push method to increment numOfOrder by 1, creates a Medicine using numOfOrder as the medID and adds a Medicine in the stack. public void print() The method is given in the attached file. Do not make any changes to the method. private void push() The method is given in the attached file. Do not make any changes to the method. public Medicine popo The method is given in the attached file. Do not make any changes to the method. public int stackSize() Counts how many medicines are in stack. Returns the count. public int sumItems() Returns the sum of the totalItems in the stack. public double average() Calculates the average of the totalItems in the stack and returns its value

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago