목록자바 (19)
develope_kkyu
Accoung.java public class Account { private String ano; private String owner; private int balance; private int password; public Account(String ano, String owner, int balance, int password) { this.ano = ano; this.owner = owner; this.balance = balance; this.password = password; } public String getAno() { return ano;// this.ano } public void setAno(String ano) { this.ano = ano; } public String getO..
Account.java public class Account { private String ano; private String owner; private int balance; public Account(String ano, String owner, int balance) { this.ano = ano; this.owner = owner; this.balance = balance; } public String getAno() { return ano;// this.ano } public void setAno(String ano) { this.ano = ano; } public String getOwner() { return owner;// this.owner } public void setOwner(Str..
public static void main(String[] args) { // for문은 활용하여 1~100까지의 누적합 구하기. int total = 0; int index;// for문 밖에서 index를 사용하는 부분이 있기 때문에 변수 선언은 for문 밖에서 사용. for (index=1; index 초기값을 설정 // index 반복에 대한 조건. // index++ ==> for문 마감시 처리하는 실행문 total = total + index; System.out.printf("%d번째까지의 누적합 %d입니다. \n", index, total); } System.out.printf("index = %d \t total=%d \n", index-1, total); } -- 1번째까지의 누적합 1..
public static void main(String[] args) { // 점수가 60점 이상이면 합격, 그 중에서도 90점 이상일 경우 장학생여부 판별하는 프로그램 // 60점 이하면 불합격 그 중에서도 40점 이하일 경우는 5년내 시험 자격불가 int score = 40; System.out.printf("score = %d \n", score); if (score >= 60) { // 60보다 클 경우 실행문 System.out.println("당신은 합격하셨습니다."); if (score >= 90) { // 90보다 클 경우 장학생에 관련 로직 System.out.println("당신은 장학생이 되셨습니다."); } else { System.out.println("아쉽게도 장학생은 아닙니다...
public static void main(String[] args) { int human1 = 99; int result1 = ++human1 * 10; //위 한줄은 아래 2줄과 같은 의미임. // human1 = human+1;==> human1 = 100; // int result1 = human1 * 10;==> result1 = 1000; System.out.printf("human1 = %d, result1 = %d \n", human1, result1); int human2 = 99; int result2 = human2++ * 10; // int result2 = human2 * 10;==> result2 = 990; // human2 = human2 + 1;==> human2 = 100..
public static void main(String[] args) { Scanner sc = new Scanner(System.in);// 키보드로부터 입력받겠다. int age; System.out.print("당신의 나이를 입력하세요."); age = sc.nextInt();//정수만 받음 System.out.printf("당신의 나이는 %d세입니다. \n", age); sc.nextLine();// 강제로 찌꺼기 소화. System.out.print("당신의 이름은? ==>"); String name; name = sc.nextLine();//문자형으로 받음 System.out.printf("당신의 이름은 %s입니다.\n", name); System.out.print("오늘의 온도는? ==>")..
// 홀수 단만 출력할 수 있도록 프로그램 변경. int a,b; for (a = 1; a
// a, b라는 것은 for 문안의 변수로 활용할 것이고. 이중 Loop (2중 for문)을 활용하여 출력문 .. /* 1 X 1 = 1 1 X 2 = 2 ... 1 X 9 = 9 ----------- 2 X 1 = 2 2 X 2 = 4 ... 2 X 9 = 18 ----------- 3단, 4단, ... 9단. */ int a,b; for (a = 1; a