-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecision tree.java
More file actions
43 lines (36 loc) · 1.1 KB
/
decision tree.java
File metadata and controls
43 lines (36 loc) · 1.1 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
import java.util.*;
class Decisiontree{
public static void main(String args[])
{
int i;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the dataset");
String Outlook[]={"sunny","sunny","overcast","rainy","rainy","rainy","overcast","sunny","sunny","rainy","sunny","overcast","overcast","rainy"};
String temp[]={"high","high","high","mediuum","cold","cold","cold","high","cold","medium","medium","medium","high","medium"};
String humidity[]={"high","high","high","high","low","low","low","high","low","low","low","high","low","high"};
String wind[]={"weak","strong","weak","weak","weak","strong","strong","weak","weak","weak","strong","strong","weak","strong"};
String play[]={"no","no","yes","yes","yes","no","yes","no","yes","yes","yes","yes","yes","no"};
for(i=0;i<14;i++)
{
if(outlook[i]=='sunny'&&play[i]=='yes')
{
p++;
}
else if
{
}
if(outlook[i]=='overcast'&&play[i]=='yes')
{
}
else if
{
}
if(outlook[i]=='rainy'&&play[i]=='yes')
{
}
else if
{
}
}
}
}