Conversation
Week 7/Linked_Hash_Set.java
Outdated
| @@ -0,0 +1,69 @@ | |||
| import java.util.*; | |||
|
|
|||
| public class Linked_Hash_Set { | |||
There was a problem hiding this comment.
The name of class shoudn't contain special characters
Week 7/Linked_Hash_Set.java
Outdated
|
|
||
| public class Linked_Hash_Set { | ||
| public static void main(String[] args) { | ||
| LinkedHashSet_operations operations = new LinkedHashSet_operations(); |
There was a problem hiding this comment.
the variable name shouldn't contains special character only when it's constant variable
Week 7/Linked_Hash_Set.java
Outdated
There was a problem hiding this comment.
print some text to make the user know how to use the application and what to do next
for example
Enter the number of test cases
Enter the number of queries
etc
Week 7/Linked_Hash_Set.java
Outdated
| switch (operation) { | ||
| case "a": | ||
| number = scan.nextInt(); | ||
| operations.addValue(number); | ||
| break; | ||
|
|
||
| case "b": | ||
| operations.printSortedSet(); | ||
| break; | ||
|
|
||
| case "c": | ||
| number = scan.nextInt(); | ||
| operations.removeElement(number); | ||
| break; | ||
|
|
||
| case "d": | ||
| number = scan.nextInt(); | ||
| operations.findNumber(number); | ||
| break; | ||
|
|
||
| case "e": | ||
| operations.getSize(); | ||
| break; | ||
| } |
There was a problem hiding this comment.
Extract to a new method and also handle when user enter the f
aslo what if user entered a letter that doesn't exist
Week 7/Tree_Map.java
Outdated
| @@ -0,0 +1,66 @@ | |||
| import java.util.*; | |||
|
|
|||
| public class Tree_Map { | |||
There was a problem hiding this comment.
here also the class name
Week 7/Tree_Map.java
Outdated
| switch (operation) { | ||
| case "a": | ||
| key = scan.nextInt(); | ||
| value = scan.nextInt(); | ||
| map.addValue(key,value); | ||
| break; | ||
|
|
||
| case "b": | ||
| key = scan.nextInt(); | ||
| map.findKey(key); | ||
| break; | ||
|
|
||
| case "c": | ||
| map.getSize(); | ||
| break; | ||
|
|
||
| case "d": | ||
| key = scan.nextInt(); | ||
| map.removeElement(key); | ||
| break; | ||
|
|
||
| case "e": | ||
| map.printElements(); |
There was a problem hiding this comment.
Extract to a new method and also handle when user enter the f
aslo what if user entered a letter that doesn't exist
Week 7/Tree_Map.java
Outdated
| switch (operation) { | ||
| case "a": | ||
| key = scan.nextInt(); | ||
| value = scan.nextInt(); | ||
| map.addValue(key,value); | ||
| break; | ||
|
|
||
| case "b": | ||
| key = scan.nextInt(); | ||
| map.findKey(key); | ||
| break; |
There was a problem hiding this comment.
extract to a new method
There was a problem hiding this comment.
the same comments in other tasks
Week 7/Word_Dictionary.java
Outdated
| public void addWord(char key,String word){ | ||
| word_dectionary.get(key).add(word); |
There was a problem hiding this comment.
make it add the word automatically to its coressponding key
No description provided.