Problem Statement
Problem Statement
import java.util.Scanner;
double sum = 0;
for (double number : numbers) {
sum += number;
}
double average = sum / n;
int countGreaterThanAverage = 0;
for (double number : numbers) {
if (number > average) {
countGreaterThanAverage++;
}
}
scanner.close();
}
}
2. Some Websites impose certain rules for passwords. Write a method that checks
whether a string is a valid password. Suppose the password rule is follows:
*A password must have at least eight characters
*A password consists of only letters and digits.
*A password must contain at least two digits.
Write a Java program that prompts the user to enter a password and displays "Valid
Password" if the rule is followed or "Valid Password" if the rule is followed or
"Invalid Password" otherwise.
import java.util.Scanner;