【♣부트 캠프♣】26 [24.05.28-8일차] 허리인치를 기입안했다고.. http://www.samsunghospital.com/home/healthInfo/content/contenView.do?CONT_SRC_ID=27845&CONT_SRC=HOMEPAGE&CONT_ID=3570&CONT_CLS_CD=001021005001▲ ▲ ▲ ▲ 허리수치 구하는 방법 링크 ▲ ▲ ▲ ▲ ▲ ▲ 내 체중은 정상인가요?날이 갈수록 늘어나는 체중, 체중이 정말 늘어난건지 체중계가 고장난건지 속상하기만 합니다. 예전엔 홀쭉하던 내가 어느새 뱃살이 팽팽한 과체중이라고 합니다. 조금 있으면 비만이 되겠www.samsunghospital.com public void cnt2() { System.out.println("성별?[m/w]"); r1.gender =sc.next(); .. 2024. 5. 28. [24.05.27-7일차] public void input() {//input(매개변수 비어도돼) Scanner sc = new Scanner(System.in); int w,h;// 지역변수로 설정되어있어서 값 인식이 안됨 ㅠㅠ System.out.println("가로?");//10 w =sc.nextInt(); System.out.println("세로?");//20 h =sc.nextInt(); //return; void는 안 써도 돼 } ▶해결: import java.util.Scanner;public class Rect { int w,h;//복도에 빼놓은 물통 전역변수(글로벌변수)=인스턴스 변수 public void input() {//input(매개변수 비어도돼) Scanner sc =.. 2024. 5. 27. [부캠1주차] 2~6일차 ▶rank는 작은쪽에 ++ 된다.//석차 초기화 0-> 1로 바꾼다. for(i=0; iscore[j]) { rank[j]++;// rank는 작은쪽에 ++ }else if(score[i]▶random함수는 copy가 나온다. move하고 싶으면 중복 제거해야while(n ▶버블정렬 //연산 Bubble Sorted for(i=1;inum[j+1]) { temp = num[j]; num[j] = num[j+1]; num[j+1] = temp; } } }▶선택정렬//Selection Sort for(i=0; inum[j]) { temp=num[i]; num[i]=num[j]; num[.. 2024. 5. 26. [24.05.24-6일차] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at com.day6_ex_1.Test1.main(Test1.java:19) 원인: 범위초과 public static void main(String[] args) { //1. 5개의 정수를 배열에 입력받아 입력받은 수를 출력하고 입력받은 수중 // 가장 큰수와 적은수를 출력-어떻게 출력해? selection sort ->인덱스0값이랑 4값호출 //선언부 Scanner sc = new Scanner(System.in); int num[] = new int[5]; int i; //입력부 System.out.println("숫자 5개?"); for(i=0; i ▲Ex.. 2024. 5. 24. [24.05.23]-5일차 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at cohttp://m.day5.Test1.main(Test1.java:26)for(int i=0;i {// i→배열에서 인덱스는 사람이 생각하는 n-1이다. Exception in thread "main" java.lang.Error: Unresolved compilation problems: i cannot be resolved to a variable i cannot be resolved to a variable i cannot be resolved to a variable i cannot be resolved to a variable at com.day5_ex1.Te.. 2024. 5. 23. [24.05.22] Exception in thread "main" java.lang.Error: Unresolved compilation problems: num cannot be resolved to a variable//입력받은 수가 3의배수 or 4의 배수인지 찾으시오. 혼공 Scanner sc= new Scanner(System.in);//입력받기위해서scanner사용 int num1; //입력은 하나만 받는다. String str; //"3의 배수다" 적기위한 선언 System.out.println("한개의 수를 입력해라");//9입력 num1= sc.nextInt(); // 여기 안들어가네 쩝 str = sc.next(); if(num1%3==0 && num1%4==0) { str .. 2024. 5. 22. 이전 1 2 3 4 5 다음