-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
140 lines (129 loc) · 6.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>COCOMO Modal Calculator</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="logo.PNG">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container"></div>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark sticky-top">
<div class="container-fluid">
<a class="navbar-brand" target="_blank" href="https://amadratitus.github.io/cocomo/">
<img src="logo.PNG" alt="Logo" style="width:45px;" class="rounded">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Organic</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Semi-Detached</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Embedded</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5 mb-5 d-flex align-items-center justify-content-center">
<div class="card" style="width:60%">
<div class="card-body">
<h5 class="card-title text-center text-primary"><strong class="text-warning">Modal Calculator</strong>
</h5>
<div class="p-1 text-align-center justify-content-center">
<!--form start-->
<form>
<div class="mb-3">
<label for="linesOfCode" class="form-label">Lines of Code</label>
<input type="number" class="form-control" id="linesOfCode" required>
</div>
<div class="mb-3">
<label for="languageType" class="form-label">Select Language Type</label>
<select class="form-select" id="languageType" required>
<option value="organic">Organic</option>
<option value="semi-detached">Semi-Detached</option>
<option value="embedded">Embedded</option>
</select>
</div>
<div class="mb-3">
<label for="effort">Effort (Person-Months)</label>
<input type="text" class="form-control" id="effort" readonly>
</div>
<div class="mb-3">
<label for="developmentTime">Development Time (Months)</label>
<input type="text" class="form-control" id="developmentTime" readonly>
</div>
<div class="mb-3">
<label for="staffing">Staffing (Persons)</label>
<input type="text" class="form-control" id="staffing" readonly>
</div>
<div class="mt-2 mb-2 d-flex justify-content-center">
<button type="button" class="btn btn-outline-primary"
onclick="calculateCocomo()">Calculate</button>
</div>
</form>
<!--form end-->
</div>
</div>
</div>
</div>
<br>
<nav class="navbar navbar-expand-sm bg-light navbar-light justify-content-center fixed-bottom">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">© <script>document.write(new Date().getFullYear());</script> Made with <span style="color: red;">❤️</span> by Chris</a>
</li>
</ul>
</nav>
</div>
<!-- Bootstrap JS and dependencies -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
function calculateCocomo() {
var linesOfCode = document.getElementById('linesOfCode').value;
var languageType = document.getElementById('languageType').value;
var organicFactors = {
'a': 2.4,
'b': 1.05,
'c': 2.5,
'd': 0.38
};
var semiDetachedFactors = {
'a': 3.0,
'b': 1.12,
'c': 2.5,
'd': 0.35
};
var embeddedFactors = {
'a': 3.6,
'b': 1.20,
'c': 2.5,
'd': 0.32
};
var selectedFactors;
if (languageType === 'organic') {
selectedFactors = organicFactors;
} else if (languageType === 'semi-detached') {
selectedFactors = semiDetachedFactors;
} else {
selectedFactors = embeddedFactors;
}
var effort = selectedFactors['a'] * Math.pow(linesOfCode / 1000, selectedFactors['b']);
var developmentTime = selectedFactors['c'] * Math.pow(effort, selectedFactors['d']);
var staffing = effort / developmentTime;
document.getElementById('effort').value = effort.toFixed(2);
document.getElementById('developmentTime').value = developmentTime.toFixed(2);
document.getElementById('staffing').value = staffing.toFixed(2);
}
</script>
</body>
</html>