Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HorariDeTreballPartit {
- public static final int HORA_INICI_MATI = 9;
- public static final int HORA_FI_MATI = 14;
- public static final int HORA_INICI_TARDA = 16;
- public static final int HORA_FI_TARDA = 19;
- public static void main (String[] args) {
- Scanner lector = new Scanner(System.in);
- System.out.print("Quina hora és? ");
- int hora = lector.nextInt();
- lector.nextLine();
- if ((hora > 23)||(hora < 0)) {
- System.out.println("L'hora és incorrecta.");
- } else {
- if (((hora >= HORA_INICI_MATI)&&(hora < HORA_FI_MATI))||((hora >= HORA_INICI_TARDA)&&(hora <
- HORA_FI_TARDA))) {
- System.out.println("Treball.");
- } else {
- System.out.println("Temps lliure.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment