EE461L HW3

pdf

School

University of Texas *

*We aren’t endorsed by this school

Course

316

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

2

Uploaded by mufiq40

Report
EE461L HW3 Object Oriented Programming (OOP) In this homework, you will design and implement a class which consists of the attributes and methods for the Resource Management functionality (Hardware Set) in your team project. You have been provided with the driver code that uses the class HardwareSet that you will be developing as part of this homework. Driver code is provided to you as test_hardwareset.py Write a Python program that implements the class hardwareSet which initializes the class with the following method and private attributes __init__(self) Capacity --> total number of units. Initial value=qty Availability --> number of units available to check out. and the following methods initialize_capacity(self,qty) i n itializes capacity to qty and performs one more step get_availability(self) --> accessor function to return the number of unused units get_capacity(self) - -> accessor function to return the total capacity of units check_out(self, qty) --> method that checks out number of units specified by qty. This method should update the number of units available after check_out. This method should handle the situation if the quantity requested is greater than the current availability in the following manner: Allow users to check out the number of units that are available and then return error = -1 check_in(self, qty) --> method that checks in number of units specified by qty. This method should update the number of units available after check_in. Do not check in any quantity and return error = -1 if user tries to check in more hardware than what is checked out. What to submit: hardwareSet.py : A class that contains methods and attributes for the main program Rubric Points
__init__(self) 1 get_availability(self) 1 get_capacity(self) 1 check_out(self, qty) 1 check_in(self, qty) 1 initialize_capacity(self,qty) 1 Correct functioning of code 1 C:\Users\asamant\Documents\ee461l> & C:/Users/asamant/AppData/Local/Programs/Python/Python39/python.exe c:/Users/asamant/Documents/ee461l/test_hardwareSet.py Total capacity of units: 0 Total capacity of units: 250 Number of available units: 250 Number of units available after checking out 20 units: 230 Number of total checkedout units 20 Number of units available after checking out 300 units: 0 Number of total checkedout units 250 Could not check out requested number of units Number of units available after checking in 180 units: 180 Could not check in 100 units
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help