-
Notifications
You must be signed in to change notification settings - Fork 0
week 7 tasks added #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract to a new method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it add the word automatically to its coressponding key
No description provided.