Alguém poderia ajudar eu a melhorar este código usando o switch?
// Imprime o valor de x até quando o mesmo for maior que 1000
public class ImpValoresSwitch {
public static void main(String[] args) {
int x = 10;
String s = "";
do {
if (x % 2 == 0) {
s = "P";
} else {
s = "I";
}
switch (s) {
case "P":
x += +5;
break;
default:
x *= +2;
break;
}
System.out.println(x);
} while (x < 1000);
}
}