All puzzles
Per page
K
Integer division ยท Remainder

Minutes and seconds

Return the totalSeconds parameter written as minutes, a colon, then seconds.

timeText(135) returns "2:15".

7 strips: K1 to K7

}
K1
return text;
K2
String text = minutes + ":" + seconds;
K3
int seconds = totalSeconds / 60;
K4
int minutes = totalSeconds / 60;
K5
public static String timeText(int totalSeconds) {
K6
int seconds = totalSeconds % 60;
K7

Answer key: K. Minutes and seconds

Order: K6, K5, K7, K3, K2, K1. Extra: K4

Lines with the same mark can go in either order.

public static String timeText(int totalSeconds) {
	int minutes = totalSeconds / 60;
	int seconds = totalSeconds % 60;
	String text = minutes + ":" + seconds;
	return text;
}

Extra strip: int seconds = totalSeconds / 60;. totalSeconds / 60 is the number of whole minutes again. The seconds left over are totalSeconds % 60.