-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodsChallange.java
More file actions
35 lines (28 loc) · 1.06 KB
/
MethodsChallange.java
File metadata and controls
35 lines (28 loc) · 1.06 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
public class MethodsChallange {
public static void main(String[] args) {
int score ;
int levelCompleted ;
int bonus ;
boolean gameOver ;
int highScorePosition = calculateHighScorePosition(1500);
displayHighScorePosition("sahith",highScorePosition);
}
public static void displayHighScorePosition(String playerName , int position){
System.out.println(playerName + " managed to get into position " + position + " on the high score table");
}
public static int calculateHighScorePosition(int score){
if(score>=1000) {
System.out.println("player score is " +score);
return 1;
} else if(score>=500 && score<1000) {
System.out.println("player score is " +score);
return 2;
} else if(score>=100 && score<500){
System.out.println("player score is " +score);
return 3;
} else{
System.out.println("player score is " +score);
return 4;
}
}
}