Ap Ex-5 .......
Ap Ex-5 .......
Ap Ex-5 .......
Experiment 5
1. Aim:
Problem Statement: - There is a sequence of words in CamelCase as a
string of letters s, having the following properties:
It is a concatenation of one or more words consisting of English letters.
All letters in the first word are lowercase.
For each of the subsequent words, the first letter is uppercase and rest of
the letters are lowercase. Given, determine the number of words in s
2. Objective:
The objective of this experiment is to implement a function in Java that
counts the number of words in a camel case formatted string.
3. Implementation/Code:
class Result {
return "pangram";
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
4. Output:
Problem -2
1. Aim:
Problem Statement: - Louise joined a social networking site to stay in touch
with her friends. The signup page required her to input a name and a password.
However, the password must be strong. The website considers a password to
be strong if it satisfies the following criteria:
Its length is at least.
It contains at least one digit.
It contains at least one lowercase English character.
It contains at least one uppercase English character.
It contains at least one special character. The special characters are:
!@#$%^&*()-+.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
2. Objective:
The objective of this experiment is to implement a function in Java that
determines the minimum number of characters needed to make a given
password "strong" according to specific criteria.
3. Code:
class Result {
hasUpperCase = true;
} else if (specialCharacters.contains(Character.toString(ch)))
{ hasSpecialChar = true;
}
}
// Count missing character types
if (!hasDigit) count++;
if (!hasLowerCase) count++;
if (!hasUpperCase) count++;
if (!hasSpecialChar) count++;
4. Output:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Learning Outcome
i. Learn to efficiently process strings and manipulate individual characters
ii. Learn to work with strings in Java, including iterating over characters,
checking character properties, and applying conditions based on those
properties.
iii. Understand basic password strength requirements, which is essential for
developing secure applications.
iv. Develop skills in analyzing strings and manipulating characters in Java,
which is critical in many programming tasks.