-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion74_alejandroI.java
More file actions
46 lines (29 loc) · 1.16 KB
/
Question74_alejandroI.java
File metadata and controls
46 lines (29 loc) · 1.16 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
package week6_String;
import java.util.Scanner;
public class Question74_alejandroI {
public static void main(String[] args) {
// olcay // Jul 6, 2020
/*
alejandro have started learning java, he knows what you know about ifs and strings.
he has a large number of text emails, going trough all of them will take a lot of time.
to save time he will only read the emails that refer to him by name.
he wants to write a program that gets a string (the email) and determines if his name "alejandro"
appears in that string. if so it will output "read this mail" else it will output "dont read".
for example:
a = "dear alejandro.....alot of text"
outputs: "read this mail"
a = "thunder blaz is the best drink in the galaxy..."
outputs: "dont read"
a = "subject : important project, alejandro we refer to you this ...."
outputs: "read this mail"
*/
Scanner s = new Scanner(System.in);
System.out.println("Write somthing:");
String a = s.nextLine();
if(a.contains("alejandro")) {
System.out.println("read this mail");
}else {
System.out.println("dont read");
}
}
}