QUESTION

Java Android Studio Project:

Scenario: You need to build the mobile app that can add two strings and display the output. For example,

String 1=” Hello”;\

String 2=” World.”

Once user click Add String button, then the output should be Hello World.

Add one more button in the above UI that compares the String 1 and String 2.

For Example,

String 1=”Hello”

String 2=”hello”

Output: Not matching

String 1=”Hello”

String 2=”Hello”

Output: Matching

Add a button to count the number of times occurrences of following characters in String 1 and String 2.

a, e, i, o, u and then add both the counts

For Example,

String 1= “Hello”

String 2=”World”

Output=3

Your app should have following UI components:

  1. Labels and textboxes for String 1, String 2
  2. Button for Add Strings
  3. Display Output
  4. Add Button to compare the strings
  5. Count the character occurrences in both the strings and add them

Follow this step by step approach to resolve this problem:

  1. Create the android studio project
  2. Use Android studio layout editor
  3. Add textboxes and labels
  4. Add Button in the UI
  5. Declare variables before onCreate function
  6. Add a method onClick inside btnAddStrings.setOnClickListener
  7. Add a code inside onClick to add two string
  8. Run the entire project and validate the output screen

Public Answer

Y5ZLTI The First Answerer