Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- boolean gameOver = true;
- int score = 800;
- int levelCompleted = 5;
- int bonus = 100;
- // if (score == 5000) {
- // System.out.println("Your score was 5000");
- // }
- //
- // if (score <5000 && score >1000) {
- // System.out.println("Your score was less than 5000 but greater than 1000");
- // } else if (score < 1000) {
- // System.out.println("Your score was less than 1000");
- // } else {
- // System.out.println("Got here");
- // }
- if (gameOver) {
- int finalScore = score + (levelCompleted * bonus); // cannot be used outside of this code block (SCOPE)
- System.out.println("Your final score was " + finalScore);
- }
- boolean newGameOver = true;
- int newScore = 10000;
- int newLevelCompleted = 8;
- int newBonus = 200;
- if (newGameOver) {
- int newFinalScore = newScore + (newLevelCompleted * newBonus);
- System.out.println("Your new final score is " + newFinalScore);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement