Java/Java practice

[자바] 총점, 평균 및 성적(수우미양가) 산출

praybe 2021. 10. 29. 19:12

국영수 총점 평균 및 수우미양가출력

public class PraybeBlog {
	public static void main(String[] args) {

		int kor = 86;
		int eng = 97;
		int math = 64;
		
		//국영수 총점 평균 
		int total = kor + eng + math;
		double avg = total / 3.0;
		System.out.println("총점: "+ total);
		System.out.println("평균: "+ avg);
		
		//수우미양가출력
		if(avg >=90) {
			System.out.println("수 입니다.");
		} else if (avg >= 80) {
			System.out.println("우 입니다.");
		}else if (avg >= 70) {
			System.out.println("미 입니다.");
		}else if (avg >= 60) {
			System.out.println("양 입니다.");
		}else {
			System.out.println("가 입니다.");
		}


	}