-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayersClub.java
67 lines (56 loc) · 1.82 KB
/
PlayersClub.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
57
58
59
60
61
62
63
64
65
66
67
package tHaleyadhu;
class PlayerRating{
int PlayerPosition;
String PlayerName;
float CriticOneRating;
float CriticTwoRating;
float CriticThreeRating;
float averageCriticRating;
public char category;
public PlayerRating(){
}
public PlayerRating(int playerposition,String playername){
PlayerPosition=playerposition;
PlayerName=playername;
}
public void calculateAverageCriticRaating(float CriticOneRating ,float CriticTwoRating) {
this.CriticOneRating=CriticOneRating;
this.CriticTwoRating=CriticTwoRating;
float sum= CriticOneRating+CriticTwoRating;
averageCriticRating=sum/2;
}
public void calculateAverageCriticRaating(float CriticOneRating ,float CriticTwoRating,float CriticThreeRating) {
this.CriticOneRating=CriticOneRating;
this.CriticTwoRating=CriticTwoRating;
this.CriticThreeRating=CriticThreeRating;
float sum= CriticOneRating+CriticTwoRating+CriticThreeRating;
averageCriticRating=sum/3;
}
public void Calculatecategory(char category) {
this.category=category;
if(averageCriticRating>8)
category='A';
else if((averageCriticRating>=5)&&(averageCriticRating<=8))
category='B';
else if((averageCriticRating>=0)&&(averageCriticRating<5))
category='C';
else
category= '!';
}
public void Display() {
System.out.println("player name is"+PlayerName);
System.out.println("player position is"+PlayerPosition);
System.out.println("CriticOneRating is"+CriticOneRating);
System.out.println("CriticTwoRating is"+CriticTwoRating);
System.out.println("CriticThreeRating is"+CriticThreeRating);
System.out.println("AvergeCriticRating is"+averageCriticRating);
System.out.println("player category is:" +category);
}
}
public class PlayersClub {
public static void main(String[] args ) {
PlayerRating p1= new PlayerRating(1,"vinod");
p1.calculateAverageCriticRaating(1, 1, 1);
p1.Display();
}
}