71 lines
1.8 KiB
Python
71 lines
1.8 KiB
Python
|
#!/usr/bin/python3.5
|
||
|
"""Calculate the stocking speed of employees"""
|
||
|
from datetime import timedelta
|
||
|
|
||
|
|
||
|
class Person():
|
||
|
"""Defines: name, cases, start/end time for eomployees"""
|
||
|
def __init__(self, name, cases, start_time, end_time):
|
||
|
self.name = name
|
||
|
self.cases = cases
|
||
|
self.start_time = start_time
|
||
|
self.end_time = end_time
|
||
|
|
||
|
def get_name(self):
|
||
|
"""Prints the name"""
|
||
|
return self.name
|
||
|
|
||
|
def get_cases(self):
|
||
|
"""Gets the cases"""
|
||
|
return self.cases
|
||
|
def get_start(self):
|
||
|
"""Gets start_time""" #store the delta start time here
|
||
|
|
||
|
return self
|
||
|
|
||
|
def get_end(self):
|
||
|
"""get end time"""
|
||
|
return self.end_time
|
||
|
|
||
|
def start_time():
|
||
|
"""Get start time"""
|
||
|
start_hour = int(input("What is the current hour?: "))
|
||
|
start_minute = int(input("What is the current minute?:"))
|
||
|
|
||
|
started_time = timedelta(hours=start_hour, minutes=start_minute)
|
||
|
|
||
|
if start_hour > 24 or start_minute > 60 or start_hour < 0 or start_minute < 0:
|
||
|
print("These values are fucked")
|
||
|
else:
|
||
|
print("Start Time:", started_time)
|
||
|
|
||
|
return started_time
|
||
|
##end
|
||
|
|
||
|
def test():
|
||
|
"""test function"""
|
||
|
start_time()
|
||
|
|
||
|
def main():
|
||
|
"""main func"""
|
||
|
|
||
|
starting_time = timedelta(hours=1, minutes=30)
|
||
|
ending_time = timedelta(hours=4, minutes=00)
|
||
|
|
||
|
duration = ending_time - starting_time
|
||
|
print(duration)
|
||
|
name = input("Enter a name: ")
|
||
|
cases = input("Enter cases: ")
|
||
|
start_time = input("Enter start_time: ")
|
||
|
end_time = input("Enter end time: ")
|
||
|
|
||
|
person = Person(name, cases, start_time, end_time)
|
||
|
|
||
|
print("Name: " + person.get_name() + "\n")
|
||
|
print("Cases: " + person.get_cases() + "\n")
|
||
|
print("Start Time: " + person.get_start() + "\n")
|
||
|
print("End Time: " + person.get_end() + "\n")
|
||
|
#main()
|
||
|
|
||
|
test()
|