Cute Happy Ghost
본문 바로가기
JAVA/Java

20200928_8 반복문,배열 Review

by JENN_tech7 2020. 9. 28.
728x90
SMALL
  • 성과급계산

코드짜다가 이렇게나왔는뎈ㅋㅋㅋㅋㅋ

아 졸라 뻘하게웃겨 ㅠㅠㅠㅠㅠ

실적 1000인데 1200달성했는데 보너스 왜 -100이얔ㅋㅋㅋㅋ 우헤헤

 

 

 

아 코드 또잘못짰는데 이것도 웃곀ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ큐ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

200초과달성했는데 2000만원준댘ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

 

 

 

package review; //성과급 계산
import java.util.Scanner;
public class Re01 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int goal = 1000;		
		System.out.print("실적을 입력하시오(단위:만원) : " );
		int score = in.nextInt();
		
		if (score > goal) {
			System.out.println("실적달성");
			double bonus = (score-goal)/10;
			System.out.println("보너스 : " + bonus);
		}
		if (score < goal) {
			System.out.println("실적달성실패");
		}
	}

}

이런건 쉬우니까 잘못나와도 ㅎㅎ~ 하고넘길수있다

 

 

 

  • 학생성적평가
package review;
import java.util.Scanner;
public class Re02 {

	public static void main(String[] args) 
	{
		Scanner in = new Scanner(System.in);

		System.out.print("성적을 입력하시오");
		int score = in.nextInt();
		if (score > 89) {
			System.out.println("학점 : A");
		}else if (score >79 && score < 90) {
			System.out.println("학점 : B");
		}else if (score >69 && score < 80) {
			System.out.println("학점 : C");
		}
		else {
			System.out.println("노답입니다. 채점할수없습니다");
		}

	}

}


70점 이하는 노답드립니다

 

 

 

  • 원하는 구구단 출력
package review; // 원하는 구구단 출력
import java.util.Scanner;
public class Re03 {

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		System.out.print("구구단 중에서 출력하고 싶은 단을 입력하세요 : ");
		int num = in.nextInt();
		int[] a= new int[10];
		
		for (int i = 1; i < 10; i++) {
			a[i] = i*num;
			System.out.println(num + " * " + i + " = " + a[i]);
		}
		
	}
}
구구단 중에서 출력하고 싶은 단을 입력하세요 : 9 
9 * 1 = 9 
9 * 2 = 18 
9 * 3 = 27 
9 * 4 = 36 
9 * 5 = 45 
9 * 6 = 54 
9 * 7 = 63 
9 * 8 = 72 
9 * 9 = 81
728x90
LIST

댓글