neongm

development cost estimation

Oct 11th, 2021
1,292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.57 KB | None | 0 0
  1. from enum import Enum
  2.  
  3.  
  4. class progr_language(Enum):
  5.     ASSEMBER = 1.0
  6.     MACROASSEMBLER = 0.95
  7.     HIGH = 0.85
  8.     OVERHIGH = 0.75
  9.  
  10.     CPP = OVERHIGH
  11.     PYTHON = OVERHIGH
  12.     JAVASCRIPT = OVERHIGH
  13.     CSHARP = OVERHIGH
  14.     C = HIGH
  15.     RUST = HIGH
  16.     OTHER = HIGH
  17.     ASM = ASSEMBER
  18.     FASM = ASSEMBER
  19.     NASM = ASSEMBER
  20.  
  21.  
  22. class work():
  23.     def __init__(self):
  24.         self.modules = []
  25.         self.overall_cost = 0
  26.         self.overall_human_hours = 0
  27.  
  28.     def add_module_by_hours(self, pl :progr_language, hr: float, cph: int = 250):
  29.         self.overall_cost += hr * pl.value * cph
  30.         self.overall_human_hours += hr * pl.value
  31.         print(f'added module: lang type: {pl.name}, {hr} hours -> {hr*pl.value}hours because of language, cost per hour = {cph}')
  32.         print(f'overall cost -> {self.overall_cost}, overall human hours -> {self.overall_human_hours}\n')
  33.  
  34.     # rate is in lines per hour
  35.     def add_module_by_size(self, pl :progr_language, size_lines: int, rate_lines_per_hour: int, cph: int = 250):
  36.         self.add_module_by_hours(pl, size_lines/rate_lines_per_hour, cph)
  37.  
  38.     def get_cost(self): return self.overall_cost
  39.     def get_human_hours(self): return self.overall_human_hours
  40.  
  41.  
  42. def main():
  43.     w = work()
  44.     # no console input yet, just adding stuff here
  45.     w.add_module_by_hours(progr_language.JAVASCRIPT, 40)
  46.     w.add_module_by_size(progr_language.PYTHON, 1200, 75, 350)
  47.  
  48.     print(f'\noverall cost: {w.get_cost()}')
  49.     print(f'overall human hours time: {w.get_human_hours()}')
  50.  
  51.  
  52. if __name__ == "__main__": main()
  53.  
Advertisement
Add Comment
Please, Sign In to add comment