public class App {                 public static String convertToUpperCase(String str) {   return result;     }       public static String convertToLowerCase(String str) {           return result;     }     public static int lengthOfString(String str){            return result;     }     public static int indexOfWord(String str, String word){                 return result;     }       public static String removeFirstCharOccurrence(String str, char c){              return result;      }       public static String replaceString(String str, String w1, String w2){                 return result;     }       public static int compareStrings(String s1, String s2){         return result;     }       public static void main( String[] args )     {         String str = "";         System.out.println( "Welcome to Lab 3" );         Scanner keyboard = new Scanner(System.in);         System.out.println( "Enter a string then press enter:" );         str = keyboard.nextLine();         System.out.println("The string in Upper case: " + convertToUpperCase(str));           System.out.println("The string in Lower case: " + convertToLowerCase(str) );                 System.out.println("The length of the string is: " +lengthOfString(str));                 System.out.println( "Enter a word to search for: " );         String word1 = keyboard.next();         keyboard.nextLine();         System.out.println("Index of "+ word1+" is: "+indexOfWord(str,word1) );           System.out.println( "Enter another word to replace it with the earlier word :" );         String word2 = keyboard.nextLine();         System.out.println("After replacement: " + replaceString(str, word1, word2));           System.out.println("Enter a letter to remove from the original string: ");         char c = keyboard.next().charAt(0);         keyboard.nextLine();         System.out.println("The string after removing first occurrence of '"+ c + "' is: "+ removeFirstCharOccurrence(str,c));           System.out.println("Enter the first String: ");         String s1 = keyboard.nextLine();         System.out.println("Enter the second String: ");         String s2 = keyboard.nextLine();         if (compareStrings(s1,s2) < 0){             System.out.println("The string: "+s1+" ,comes before "+s2);         }         else if (compareStrings(s1, s2) > 0){             System.out.println("The string: "+s2+" ,comes before "+s1);         }         else{             System.out.println("The string: "+s2+" and "+s1+" are equal");         }           keyboard.close();     } }   1. Convert all the characters in the string to upper cases 2. Convert all the characters in the string to lower cases 3. Find number of characters in the string 4. Find/search for a word within the string 5. Replace a word within the string with a new word 6. Remove a letter from the string 7. Compare two strings alphabetically Tips: you might use the following methods: • length ( ) • indexOf ( ) • toUpperCase( ) • toLowerCase( ) • substring ( ) • compareTo ( ) Grading and Submission Your grade will be based on your effort on trying to complete the exercise.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

 

 

public class App

{

   

   

   

    public static String convertToUpperCase(String str) {

 

return result;

    }

 

    public static String convertToLowerCase(String str) {

          return result;

    }

    public static int lengthOfString(String str){       

    return result;

    }

    public static int indexOfWord(String str, String word){

       

        return result;

    }

 

    public static String removeFirstCharOccurrence(String str, char c){

 

 

         return result;

     }

 

    public static String replaceString(String str, String w1, String w2){

       

        return result;

    }

 

    public static int compareStrings(String s1, String s2){

        return result;

    }

 

    public static void main( String[] args )

    {

        String str = "";

        System.out.println( "Welcome to Lab 3" );

        Scanner keyboard = new Scanner(System.in);

        System.out.println( "Enter a string then press enter:" );

        str = keyboard.nextLine();

        System.out.println("The string in Upper case: " + convertToUpperCase(str));

 

        System.out.println("The string in Lower case: " + convertToLowerCase(str) );

       

        System.out.println("The length of the string is: " +lengthOfString(str));

       

        System.out.println( "Enter a word to search for: " );

        String word1 = keyboard.next();

        keyboard.nextLine();

        System.out.println("Index of "+ word1+" is: "+indexOfWord(str,word1) );

 

        System.out.println( "Enter another word to replace it with the earlier word :" );

        String word2 = keyboard.nextLine();

        System.out.println("After replacement: " + replaceString(str, word1, word2));

 

        System.out.println("Enter a letter to remove from the original string: ");

        char c = keyboard.next().charAt(0);

        keyboard.nextLine();

        System.out.println("The string after removing first occurrence of '"+ c + "' is: "+ removeFirstCharOccurrence(str,c));

 

        System.out.println("Enter the first String: ");

        String s1 = keyboard.nextLine();

        System.out.println("Enter the second String: ");

        String s2 = keyboard.nextLine();

        if (compareStrings(s1,s2) < 0){

            System.out.println("The string: "+s1+" ,comes before "+s2);

        }

        else if (compareStrings(s1, s2) > 0){

            System.out.println("The string: "+s2+" ,comes before "+s1);

        }

        else{

            System.out.println("The string: "+s2+" and "+s1+" are equal");

        }

 

        keyboard.close();

    }

}

 

1. Convert all the characters in the string to upper cases 2. Convert all the characters in the string to lower cases 3. Find number of characters in the string 4. Find/search for a word within the string 5. Replace a word within the string with a new word 6. Remove a letter from the string 7. Compare two strings alphabetically Tips: you might use the following methods:

• length ( )

• indexOf ( )

• toUpperCase( )

• toLowerCase( )

• substring ( )

• compareTo ( )

Grading and Submission

Your grade will be based on your effort on trying to complete the exercise.

 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education