-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathCyclomatricComplexity.java
More file actions
53 lines (45 loc) · 1.23 KB
/
CyclomatricComplexity.java
File metadata and controls
53 lines (45 loc) · 1.23 KB
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
/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class CyclomatricComplexity {
/*
Problem Statement: Need to print biggest number from given numbers
*/
public static void main (String[] args) {
Integer a=7,b=4,c=10,d=18;
if (a > b) {
if(a > c){
if (a >d){
System.out.println(a+ " is biggest");
}
}
}
if (b > c) {
if(b > d){
if (b >a){
System.out.println(b+ " is biggest");
}
}
}
if (c > b) {
if(c > a){
if (c >d){
System.out.println(c+" is biggest");
}
}
}
if (d > b) {
if(d > c){
if (d >a){
System.out.println(d+" is biggest");
}
}
}
}
}
// Take Away:
// If the decision points are more, then complexity of the program is more.
// If program has high complexity number, then probability of error is high
// with increased time for maintenance and trouble shoot.