- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuman.java
More file actions
Latest commit
57 lines (50 loc) · 1.32 KB
/
Copy pathHuman.java
File metadata and controls
57 lines (50 loc) · 1.32 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
51
52
53
54
55
56
57
importjava.io.*;
importjava.util.*;
/**
* Human ist die Klasse für einen menschlichen Spieler
*
* @author Götz und Dominik
* @version 9.11
*/
publicclassHumanextendsPlayer
{
publicHuman()
{
}
publicvoidset_name(){
Out.println("Spieler: ");
Out.println("Bitte geben Sie ihren Namen ein");
this.name = In.readWord();
Out.println("");
}
publicStringword_input()
{
System.out.println(this.get_name() + ", bitte geben Sie ein Wort ein: ");
Stringword = In.readWord();
word = word.toUpperCase();
if (word.equals("PENIS"))
{
Out.println("");
Out.println("Sorry, dein 'Wort' ist zu kurz!");
Out.println("");
this.sleep(2);
}
returnword;
}
publicStringguess()
{
System.out.println(this.get_name() + ", bitte geben Sie einen Buchstaben ein: ");
Stringchr = In.readWord();
chr = chr.toUpperCase();
returnchr;
}
publicvoidsleep(intseconds)
{
intmilli_seconds = 1000 * seconds;
try {
Thread.sleep(milli_seconds);
} catch(InterruptedExceptionex) {
Thread.currentThread().interrupt();
}
}
}