# Write a program to find
#     FUNCTION POINT

# THE 5 FUNCTIONAL UNITS
# 1.    Internal Logical Files (ILF)    -   Control Info or Logically related data present within the system
# 2.    External Interface Files (EIF)  -   Control Info or Logically related data referenced by the system but present outside the system
# 3.    External Inputs (EI)            -   The Data that comes from outside our system
# 4.    External Outputs (EO)           -   The Data that is generated by the system
# 5.    External Enquiries (EQ)         -   Combination of Input-Output resulting in Data Retreival


#  1,2 -> Data Function Types
# 3,4,5-> Transaction Function Types


#Dependent on the organization
#Based on past projects
weight_matrix = [[3,4,6], [4,5,7], [3,4,6], [7,10,15], [5,7,10]]
#SOURCE : https://stackoverflow.com/questions/34473698/how-to-calculate-function-points
severity_rank = [0,0,0,0,0]
counts = [0,0,0,0,0]
functional_units = ['External Inputs', 'External Outputs', 'External Enquiries', 'Internal Logical Files', 'External Interface Files']
severity = ['Low', 'Average', 'High']


# print("ENTER THE WEIGHING FACTORS FOR FOLLOWING FUNCTIONAL UNITS : ")
# for i in range(5):
#     for j in range(3):
#         str = functional_units[i]+"\t\t->\t\t"+severity[j]+"\t\t: "
#         weight_matrix[i][j] = int(input(str))

print("\n\nENTER SEVERITY FOR EACH FUNCTIONAL UNIT : ")
print("0 : LOW\n1:AVERAGE\n2: HIGH\n\n")
for i in range(5):
    str = functional_units[i]+" : "
    severity_rank[i] = int(input(str))

print("\n\n")
for i in range(5):
    str = "Enter Number of "+functional_units[i]+" : "
    counts[i] = int(input(str))


#CALCULATE UNADJUSTED FUNCTION POINTS
UFP=0
for i in range(5):
    UFP+=(counts[i]*weight_matrix[i][severity_rank[i]])

print("\n\nUNADJUSTED FUNCTION POINTS : ",UFP)



# COMPLEXITY ADJUSTMENT FACTOR
print("\n\nRate The Following Questions on a scale of 0 to 5")
print("0: No Influence\n1: Incidental\n2: Moderate\n3: Average\n4: Significant\5: Essential\n\n")
#SOURCE FOR 14 General System Characterstics : https://www.codeproject.com/Articles/18024/Calculating-Function-Points
question = ['Data Communication','Distributed Data Processing','Performance','Heavily Used Configuration','Transaction Role','Online Data Entry','End-User Efficiency','Online Update','Complex Processing','Reusability','Installation Ease','Operational Ease','Multiple Sites','Facilitate Change']
rating = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
TDI=0   # Total Degree of Influence of the 14 General System Characteristics.
for i in range(14):
    str = question[i]+" : "
    rating[i] = int(input(str))
    TDI+=rating[i]

CAF = 0.65+(0.01*TDI)   
print("\n\nCOMPLEXITY ADJUSTMENT FACTOR : ",CAF)



# FINAL FUNCTION POINT CALCULATION
FFP = UFP*CAF
FFP = round(FFP)
print("\n\nFINAL FUNCTION POINTS = ",FFP)