Skip to main content

Command Palette

Search for a command to run...

[Java] Code Organization

Published
•View as Markdown
[Java] Code Organization
public class Main {

    public static void main(String[] args) {

        boolean gameOver = true;
        int score = 800;
        int levelCompleted = 5;
        int bonus = 100;

        if (gameOver) {
            int finalScore = score + (levelCompleted * bonus);
            System.out.println("Your final score was " + finalScore);

        }

        boolean newGameOver = true;
        int secondScore = 10000;
        int secondLevelCompleted = 8;
        int secondBonus = 200;

        if(newGameOver) {
            int finalScore = secondScore + (secondLevelCompleted * secondBonus);
            System.out.println("Your second final score was " + finalScore);
        }
    }
}

More from this blog

Jayden's Blog

166 posts