+ 2

Tom and Bob are playing a board game, in which both players start with the same number of points. Tom output 6 and Bob 6.

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); //taking initial score int initScore = scanner.nextInt(); int scoreTom = 5; int scoreBob = 5; System.out.println("Round 1 results:"); //fix System.out.println(++scoreTom); System.out.println(--scoreBob); } }code is not working.

22nd Feb 2023, 11:31 AM
Swami Siddhi Vinayak
2 Respuestas
+ 3
Hey Swami, Your so close, you want to set Tom & Bobs score from the initial Score (so that it passes the test cases, when a different initial score is provided as the input) Change these lines: int scoreTom = 5; int scoreBob = 5; to: int scoreTom = initScore; int scoreBob = initScore; and your golden :D
22nd Feb 2023, 11:56 AM
DavX
DavX - avatar
+ 2
Thanks
22nd Feb 2023, 12:29 PM
Swami Siddhi Vinayak