-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCh03_16_Practice6.java
More file actions
50 lines (39 loc) · 1.74 KB
/
Ch03_16_Practice6.java
File metadata and controls
50 lines (39 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.Scanner;
public class Ch03_16_Practice6 {
public static void main(String[] args) {
//Name Formatter
Scanner input = new Scanner(System.in);
System.out.print("Enter Your Name: ");
String name = input.nextLine();
String CapName = name.toUpperCase();
String CurName = name.toLowerCase();
System.out.printf("Name in capitals is %s\n" , CapName);
System.out.printf("Name in lowercase is %s\n" , CurName);
System.out.println(" ");
//Password Maker
System.out.println("Enter Your Password: ");
String Pass = input.nextLine();
String maskedpass = Pass.charAt(0) + "*******" + Pass.charAt(Pass.length()-1);
System.out.printf("Entered Pass: %s\n" , maskedpass);
System.out.println(" ");
//Vowel Detector
System.out.print("Enter Your Statement: ");
String statement = input.nextLine();
int a = statement.indexOf('a');
int e = statement.indexOf('e');
int o = statement.indexOf('o');
int i = statement.indexOf('i');
int u = statement.indexOf('u');
System.out.println("Index of 'a' if any in statement: " + a);
System.out.println("Index of 'e' if any in statement: " + e);
System.out.println("Index of 'i' if any in statement: " + i);
System.out.println("Index of 'o' if any in statement: " + o);
System.out.println("Index of 'u' if any in statement: " + u);
System.out.println(" ");
//Spam Detector
System.out.print("Enter your received message: ");
String spam = input.nextLine();
System.out.print("Spam message:" + spam.contains("money"));
System.out.println("*********");
}
}