Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HorariDeTreball {
- public static final int HORA_INICI = 9;
- public static final int HORA_FI = 17;
- 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)&&(hora < HORA_FI)) {
- System.out.println("Treball.");
- } else {
- System.out.println("Temps lliure.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement