JAVA/프로그래머스 자바 입문

파트3. 제어문 [논리연산자 - 실습(1)]

RiLLa_0511 2023. 2. 24. 15:31
728x90

[ Programmers  - 무료 자바 입문 강의 ]

 

 

https://school.programmers.co.kr/learn/courses/5/lessons/229

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

public class LogicalOperatorExam {
    public boolean isAgeDiscountable(int age) {
        boolean isDiscount = false;
        // 아래 빈칸을 채워 코드를 완성하세요.
        if( age <= 19 || age >= 60 ) {
            isDiscount = true;
        }
        else {
            isDiscount = false;
        }
        return isDiscount;
    }

    public static void main(String[]args) {
        LogicalOperatorExam exam = new LogicalOperatorExam();
        exam.isAgeDiscountable(15);
        exam.isAgeDiscountable(27);
    }
}

 

 

출처) https://school.programmers.co.kr/learn/courses/5/lessons/144