-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathChain.java
56 lines (45 loc) · 1.16 KB
/
Chain.java
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
package P2;
public class Chain {
String cahrname,Avatar,rank;
int level;
float ingamecurrency;
public Chain(String cahrname, String avatar, String rank, int level, float ingamecurrency) {
this.cahrname = cahrname;
this.Avatar = avatar;
this.rank = rank;
this.level = level;
this.ingamecurrency = ingamecurrency;
}
public Chain() {
this("Aravindan","hulk","ace",106,1000.0f);
System.out.println("this is default constructor");
}
public Chain(Chain pubg )
{
this.cahrname = pubg.cahrname;
this.Avatar = pubg.Avatar;
this.rank = pubg.rank;
this.level = pubg.level;
this.ingamecurrency = pubg.ingamecurrency;
}
void computerank(int kills,float time)
{
if((kills>200)&&(time<30))
{
System.out.println("gold");
}
}
//method overloading
void computerank(int kills,float time,int damage)
{
if((kills>200)&&(time<30)&&(damage>500))
{
System.out.println("gold");
}
}
@Override
public String toString() {
return "Chain [cahrname=" + cahrname + ", Avatar=" + Avatar + ", rank=" + rank + ", level=" + level
+ ", ingamecurrency=" + ingamecurrency + "]";
}
}