← all problems

Score updates 🌶️

score holds a player's starting points, and the locked line at the bottom prints the final score. Write code in the box that updates score, in this order: (1) add 5, (2) add 1 more, (3) double it, (4) subtract 3. Use compound assignment operators (+=, -=, *=) and the increment operator (++) rather than writing score = score + ... . Your code will be tested with several different starting scores.

Main.java — the program frame below is already written; you're only completing the code in the editable box. Your code will be run several times, each with different starting values for the variables at the top.

public class Main {
    public static void main(String[] args) {
        int score = 10;
        // ---- write your code below ----
        System.out.println(score);
    }
}