Python,Pharmacy。Lab,。
Assignment Objectives
This lab will give you some hands-on practice with object-oriented programming using Python to solve some simple problems.
Getting Started
For the labs in this course you will write functions that solve computational problems. To help you get started on each assignment, we will give you on Blackboard a “bare bones” file with a name like lab8.py. These files will contain function stubs, which are functions that have no bodies. You will fill in the bodies of these functions for the assignments. Do not, under any circumstance, change the names of the functions or their parameter lists. The automated grading system will be looking for exactly those functions provided in lab8.py. You will be able to test your work by uploading your file to CodeLoad. Note that the CodeLoad tests are not exhaustive - you will want to write your own tests too!
Directions
- Solve the following problems to the best of your ability.
- At the top of the lab8.py file, include the following information in comments, with each item on a separate line:
- your first and last name as they appear in Blackboard
- your Stony Brook ID # (e.g., 110999999)
- your Net ID (e.g., jsmith)
- the course number (CSE 101)
- the assignment name and number (Lab #8)
- Your functions must be named as indicated below. Submissions that have the wrong function names can’t be graded by the automated grading system.
- Upload your .py file to Blackboard by the indicated due date and time. Late work will not be accepted for grading. Work is late if it is submitted after the due date and time.
- Code that crashes will likely receive a grade of zero, so make sure you upload your work to CodeLoad and also thoroughly test your work with additional tests before submitting it.
Disclaimer
Although all drugs used in this assignment are real, they are randomly picked. All drug prices and individual names are made up and do correspond with any individual or group in any aspect.
Preliminaries
For this lab you will be working with the following classes:
1 2 3 4 5 6 7 8 9 10
|
class Prescription: def __init__(self, patient, med_name, quantity): self.patient = patient self.med_name = med_name self.quantity = quantity
class Pharmacy: def __init__(self, inventory, unit_costs): self.inventory = inventory self.unit_costs = unit_costs
|
For this lab you will be working with the following example Pharmacy object called pharmacy created using the following inventory and unit costs dictionaries (different numbers will be assigned for the actual grading):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
inventory = #123;'Hydrocodone': 78, 'Zocor' : 25, 'Lisinopril': 150, 'Synthroid' : 32, 'Norvasc' : 100, 'Prilosec' : 44, 'Lisinopril': 150, 'Synthroid' : 32, 'Azithromycin' : 78, 'Amoxicillin' : 26, 'Lisinopril': |