FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Sources/hackerRank/enc.java at main · saken78/Java-Sources · GitHub
This repository was archived by the owner on Feb 5, 2026. It is now read-only.
saken78
/
Java-Sources
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Sources
/
hackerRank
/
enc.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
77 lines (62 loc) · 1.72 KB
Breadcrumbs
Java-Sources
/
hackerRank
/
enc.java
Copy path
File metadata and controls
77 lines (62 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package
OOP_exc
;
import
java
.
util
.
Scanner
;
class
Karakter
{
private
String
name
;
private
int
level
;
private
int
health
;
private
int
attack
;
Karakter
(
String
name
,
int
level
,
int
health
,
int
attack
) {
this
.
name
=
name
;
this
.
level
=
level
;
this
.
health
=
health
;
this
.
attack
=
attack
;
}
void
getName
() {
System
.
out
.
println
(
this
.
name
);
}
String
setName
(
String
name
) {
this
.
name
=
name
;
return
name
;
}
void
getLevel
() {
System
.
out
.
println
(
this
.
level
);
}
int
setLevel
(
int
level
) {
this
.
level
=
level
;
return
this
.
level
;
}
void
getHealth
() {
System
.
out
.
println
(
this
.
name
+
" health : "
+
this
.
health
);
}
int
setHealth
(
int
health
) {
this
.
health
=
health
;
return
this
.
health
;
}
void
getAttack
() {
System
.
out
.
println
(
this
.
attack
);
}
int
setAttack
(
int
attack
) {
this
.
attack
=
attack
;
return
this
.
attack
;
}
void
opponentAttack
(
Karakter
opponent
) {
System
.
out
.
println
(
"Attacking "
+
opponent
.
name
);
opponent
.
health
-=
this
.
attack
;
}
void
stats
() {
System
.
out
.
println
(
"Name
\t
: "
+
this
.
name
);
System
.
out
.
println
(
"Level
\t
: "
+
this
.
level
);
System
.
out
.
println
(
"Health
\t
: "
+
this
.
health
);
System
.
out
.
println
(
"Attack
\t
: "
+
this
.
attack
);
}
}
public
class
enc
{
public
static
void
main
(
String
[]
args
) {
// Scanner inputUser = new Scanner(System.in);
Karakter
freya
=
new
Karakter
(
"Nimus"
,
1
,
100
,
12
);
Karakter
ludwik
=
new
Karakter
(
"Greek"
,
1
,
100
,
14
);
freya
.
opponentAttack
(
ludwik
);
freya
.
getAttack
();
ludwik
.
getHealth
();
}
}
Back
|
FazBrowse Home
|
New Git URL