Created
August 16, 2018 04:29
-
-
Save eightseventhreethree/6b803f1a97d7ad2630e68e525e59855c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
from datetime import datetime | |
from datetime import timedelta | |
class Input(object): | |
def _set_input(self): | |
try: | |
x = input('Enter minutes as an integer: ') | |
i = int(x) | |
except ValueError: | |
print("Please enter an Integer value.") | |
sys.exit(1) | |
return i | |
def get_input(self): | |
return int(Input()._set_input()) | |
class Time(object): | |
def _calculate_time_plus_hours(self, duration): | |
time = timedelta(minutes=duration) | |
return time | |
def calculate_from_to_time(self, duration): | |
return Time()._calculate_time_plus_hours(duration) | |
class Output(object): | |
def _display_input(self, userInput): | |
print(userInput) | |
def _display_time(self, userInput): | |
output = Time().calculate_from_to_time(userInput) | |
print(output) | |
def output_all(self, userInput): | |
Output()._display_input(userInput) | |
Output()._display_time(userInput) | |
Output().output_all(Input().get_input()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment