-1
I’m using intellj and I just started a free course. I challenged myself to make a code in which you put a date and the program says the day of the week, but when trying to run the code opens a small written window
'DiaDaSemana' is not allowed to run in parallel. Would you like to stop the running one?
PS: Diadasemana is the name of the program. The window has 2 buttons (Stop and Rerun) and (Cancel), no matter what I put always happens the same thing. It allows me to write in the terminal(Run) and does not run anything else, and the code does not stop running without anything happening, here is the code: PS: no error occurs.
public class DiaDaSemana {
static public void main(String[] args) {
int semana = 3;
int dia = 22; //ENTRE COM
int mes = 7; //OS SEUS
boolean anoBicesto = false; //DADOS
if (mes > 1) {
if (anoBicesto == false) { //Sem Ano Bicesto
semana += 31 + 28;
} else { // Com Ano Bicesto
semana += 31 + 29;
}
mes -= 2;
while (mes > 0) { //Enquanto mes for maior q zero
if (mes % 2 == 1) { //Março == impar == 31
semana += 31;
}
if (mes % 2 == 0) { //Abril == par == 30
semana += 30;
}
}
}
while (semana > 7) { //tirando as semanas extras
semana -= 7;
}
switch (semana) { //Resultado!
case 1:
System.out.println("Domingo-Feriado");
break;
case 2:
System.out.println("Segunda-Feira");
break;
case 3:
System.out.println("Terça-Feira");
break;
case 4:
System.out.println("Quarta-Feira");
break;
case 5:
System.out.println("Quinta-Feira");
break;
case 6:
System.out.println("Sexta-feira");
break;
case 7:
System.out.println("Sabado-Feriado");
break;
default:
System.out.print("ERRO...ERRO...ERRO");
break;
}
}
}
What should I do to abort the previous run? In my defense I started learning Java 3 days ago on the internet, and this is just the prototype
– Nioty
@Nioty You can try to locate it in windows task manager and kill the process.
– Victor Stafusa