STRINGS
1. Login System (Authentication Module)
Scenario:
You are developing a secure login system for a company’s internal
dashboard. The system already has a stored password: `"Admin@123"`.
When a user tries to log in, they enter a password. Your job is to verify
whether the entered password matches the stored password.
If the password is correct:
Display: `"Login Successful"`
If the password is incorrect:
Display: `"Invalid Password"`
Important:
* Do NOT use `==` for comparison
* Use proper string comparison method
Write a Java program to validate the password entered by the user.
2. Input Cleaning System (User Data Processing)
Scenario:
You are building a form where users enter their names or messages.
Sometimes users accidentally add extra spaces at the beginning, end, or
between words.
For example:
```
" Hello Guys "
```
Before storing this data in the database, you need to clean it:
* Remove leading and trailing spaces
* Ensure only a single space exists between words
Expected Output:
```
"Hello Guys"
```
Write a Java program to clean the given string.
3. Palindrome Checker (Word Game App)
Scenario:
You are developing a mobile word game. One of the features checks
whether a word entered by the player is a palindrome.
A palindrome is a word that reads the same forward and backward.
Examples:
* `"madam"` → Palindrome
* `"hello"` → Not Palindrome
The system should:
* Take user input
* Reverse the string
* Compare it with the original
Output:
"Palindrome"` or `"Not Palindrome"
Write a Java program to implement this feature.
4. Vowel Analyzer (Text Analysis Tool)
Scenario:
You are building a text analysis tool that processes user input and
provides statistics. One of the features is to count how many vowels are
present in the text.
Example Input:
```
"education"
```
Expected Output:
```
Number of vowels: 5
```
Rules:
* Vowels are: a, e, i, o, u
* The program should work for both uppercase and lowercase letters
5. Email Username Extractor (User Profile System)
Scenario:
You are developing a social media platform. When a user signs up using
their email, you need to automatically generate a display username.
The rule is:
Extract the part before @ from the email
Example:
Input: "richard123@[Link]"
Output: "richard123"
System behavior:
If @ is not present → print "Invalid Email"
Task:
Write a Java program to extract the username from the email.
Concept tested: indexOf(), substring()
6. Password Strength Checker (Security Feature)
Scenario:
You are building a password validation system for a banking application.
The password entered by the user must follow these rules:
At least 8 characters long
Contains at least:
o one uppercase letter
o one lowercase letter
o one digit
Example:
Input: "Admin123"
Output: Strong Password
Input: "admin"
Output: Weak Password
Task:
Write a Java program to check whether the password is strong or weak.
Concept tested: loops, [Link](), isLowerCase(),
isDigit()
7. Scenario: Username Generator for a Company
Scenario
A company is developing an employee management system.
When a new employee joins, the system must automatically generate a
username.
Rules:
Username = first 3 letters of first name + last name
Convert the username to lowercase
Remove any spaces
Example
Input
First Name: Arun
Last Name: Thangaiah
Output
Generated Username: aruthangaiah
8. Scenario: Product Review Analyzer
Scenario
An e-commerce company wants to analyze customer reviews.
You must write a program that counts how many times the word "good"
appears in a review.
Example
Input
The product is good and the quality is good
Output
The word 'good' appears 2 times.