Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Miketo
- */
- public class Tributar {
- private static final short MIN_AGE = 16;
- private static final short MIN_SALARY = 1000;
- private static final Scanner sc = new Scanner(System.in);
- public static void main(String[] args) {
- System.out.println("Con este programa sabrás si debes tributar.\n");
- if( isOlder(readAge()) && isGoodSalary(readSalary()) ){
- System.out.println("SI debes tributar");
- return;
- }
- System.out.println("NO necesitas tributar");
- }
- private static int readAge(){
- System.out.print("Introduce tu edad: ");
- return sc.nextInt();
- }
- private static double readSalary(){
- System.out.print("Introduce tu salario: $");
- return sc.nextDouble();
- }
- private static boolean isOlder(int age){
- return age>MIN_AGE;
- }
- private static boolean isGoodSalary(double salary){
- return salary>=MIN_SALARY;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement