- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Add Task 1 code #1
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
| public class Main { | ||
| public static void main(String [] args){ | ||
| 
               | 
          ||
| Scanner sc = new Scanner(System.in); | 
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 proper Indentation of the code
| while(true) { | ||
| System.out.println("Select the operation you want to perform"); | ||
| String[] arr = {"Exit()","append()", "countWords()", "replace()", "isPalindrome()", "splice()", "split()", "maxRepeat()", "sort()", "shift()", "reverse()"}; | ||
| for (int i = 0; i < arr.length; i++) { | 
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.
Use descriptive variable names
| while(true) { | ||
| System.out.println("Select the operation you want to perform"); | ||
| String[] arr = {"Exit()","append()", "countWords()", "replace()", "isPalindrome()", "splice()", "split()", "maxRepeat()", "sort()", "shift()", "reverse()"}; | ||
| for (int i = 0; i < arr.length; i++) { | 
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.
Don't use for loop in while
| } | ||
| 
               | 
          ||
| int choice = sc.nextInt(); | ||
| sc.nextLine(); | 
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.
Descriptive varible names
| } | ||
| 
               | 
          ||
| 
               | 
          ||
| //append | 
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.
Comments should be in descriptive manner
| //sort | ||
| String sorting() { | ||
| String temp = original.toLowerCase(); | ||
| int[] freq = new int[26]; | 
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.
write frequency in place of freq
| 
               | 
          ||
| 
               | 
          ||
| for (int i = 0; i < temp.length(); i++) { | ||
| char ch = temp.charAt(i); | 
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.
Descriptive variable names
| } | ||
| } | ||
| 
               | 
          ||
| StringBuilder sb = new StringBuilder(); | 
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.
Don't use string builder
| int maxi=0; | ||
| char character=original.charAt(0); | ||
| for(int i=0;i<original.length();i++){ | ||
| char ch = original.charAt(i); | 
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.
Descriptive names, spacing between operators in whole code
| return new String(result); | ||
| } | ||
| 
               | 
          ||
| 
               | 
          
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.
Check your code again and write descriptive variable names and proper indention in the code is missing, add some space while using the operators.
No description provided.