-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataProcessing.java
More file actions
55 lines (47 loc) · 2.26 KB
/
Copy pathDataProcessing.java
File metadata and controls
55 lines (47 loc) · 2.26 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
54
55
import java.util.ArrayList;
/**
* Driver class for processing and demonstrating the Table Trouble assignment.
* Creates ProgrammingLanguage and TextEditor objects, organizes them into tables, and
* demonstrates sorting, searching, and combining of tables.
* @author Showmick Das
* @version 1.0
*/
public class DataProcessing {
/**
* Main method to run the data processing demonstration.
* @param args Command line arguments (not used)
*/
public static void main(String[] args) {
ArrayList<Datapoint> languagesList = new ArrayList<Datapoint>();
languagesList.add(new ProgrammingLanguage("Java", 3.5, 4.0));
languagesList.add(new ProgrammingLanguage("C++", 4.5, 3.0));
languagesList.add(new ProgrammingLanguage("Python", 2.0, 4.5));
languagesList.add(new ProgrammingLanguage());
languagesList.add(new ProgrammingLanguage("Ruby", 2.5, 4.2));
ArrayList<Datapoint> editorsList = new ArrayList<Datapoint>();
editorsList.add(new TextEditor("VSCode", 4.0, 3.5, 4.5));
editorsList.add(new TextEditor("Sublime", 3.8, 2.5, 4.0));
editorsList.add(new TextEditor("Atom", 3.5, 3.0, 3.8));
editorsList.add(new TextEditor());
editorsList.add(new TextEditor("Notepad++", 2.0, 2.5, 3.0));
Table languagesTable = new Table(languagesList);
Table editorsTable = new Table(editorsList);
languagesTable.sortBy(0, false);
editorsTable.sortBy(0, false);
System.out.println("Programming Languages Table:");
System.out.println(languagesTable);
System.out.println("Text Editors Table:");
System.out.println(editorsTable);
double searchValue = 3.5;
Datapoint foundLanguage = languagesTable.find(0, searchValue);
if (foundLanguage != null) {
System.out.println("Found programming language with difficulty " + searchValue + ":");
System.out.println(foundLanguage);
} else {
System.out.println("No programming language found with difficulty " + searchValue);
}
Table combinedTable = Table.combine(languagesTable, editorsTable);
System.out.println("Combined Table (Programming Languages + Text Editors):");
System.out.println(combinedTable);
}
}