-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexp3.cpp
55 lines (54 loc) · 1.76 KB
/
exp3.cpp
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
#include <iostream>
#include <math.h>
class COCOMOII
{
public:
// Function to estimate effort in Person-Months
double estimateEffort(double size, int mode)
{
// Basic formula: Effort = A * (Size ^ B) * EAF
double A = 2.94; // Example value, would be calibrated based on the project
double B = 1.067; // Example value, would be calibrated based on the project
double EAF = calculateEAF(mode); // Environmental Adjustment Factor
double effort = A * pow(size, B) * EAF;
return effort;
}
private:
// Function to calculate the Environmental Adjustment Factor (EAF)
double calculateEAF(int mode)
{
// EAF is based on various factors such as personnel capability, process maturity, etc.
// This is a simplified example, in reality, you would need to consider more factors.
double eaf = 1.0;
// Adjust based on the development mode
switch (mode)
{
case 1: // Organic
eaf *= 1.0;
break;
case 2: // Semi-Detached
eaf *= 1.2;
break;
case 3: // Embedded
eaf *= 1.5;
break;
default:
std::cerr << "Invalid mode." << std::endl;
break;
}
return eaf;
}
};
int main()
{
COCOMOII cocomo;
double projectSize;
int developmentMode;
std::cout << "Enter project size (KLOC): ";
std::cin >> projectSize;
std::cout << "Select development mode (1 for Organic, 2 for Semi-Detached, 3 for Embedded): ";
std::cin >> developmentMode;
double effort = cocomo.estimateEffort(projectSize, developmentMode);
std::cout << "Estimated effort: " << effort << " Person-Months" << std::endl;
return 0;
}