-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainChallenge.java
More file actions
42 lines (31 loc) · 1.05 KB
/
MainChallenge.java
File metadata and controls
42 lines (31 loc) · 1.05 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
public class MainChallenge {
public static void main(String[] args) {
boolean gameOver = true;
int score = 800;
int levelCompleted = 5;
int bonus = 100;
int highScore = calculateScore(gameOver,score,levelCompleted,bonus);
System.out.println("The highScore is " + highScore);
score = 10000;
levelCompleted = 8;
bonus = 200;
System.out.println("The highScore is " +calculateScore(gameOver,score,levelCompleted,bonus));
// score = 10000;
// levelCompleted = 8;
// bonus = 200;
//
// finalScore = score;
// if (gameOver == true){
// finalScore += (levelCompleted * bonus);
// System.out.println("Your final score was " + finalScore);
// }
}
public static int calculateScore(boolean gameOver,int score,int levelCompleted,int bonus){
int finalScore = score;
if (gameOver == true){
finalScore += (levelCompleted * bonus);
finalScore += 1000;
}
return finalScore;
}
}