일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 자바계산
- 자바 커피
- 맥 데이터베이스
- 자바연산자
- 자바 복습
- 자바복습
- java
- 자바 공부
- 자바연산자사용
- 자바연산
- 자바공부
- 맥북 데이터베이스
- 자바
- 자바변수
- Mac Sqlplus
- 맥 오라클
- 맥북 데이터베이스 설치
- 자바 거스름돈구하기
- 맥 sql설치
- mac oracle
- javareview
- java거스름돈구하기
- Mac db
- 맥os 데이터베이스
- 맥북 개발
- 자바거스름돈
- 자바실수
- Today
- Total
목록Java/Do it (7)
DevTagebuch

키보드로 원하는 커피의 값과 투입하려는 금액을 입력하고 거스름돈 구하기. import java.util.Scanner; public class Problem04_03 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int coffee, money, change; System.out.print("얼마짜리 커피를 드시겠어요? ==>"); coffee=s.nextInt(); System.out.print("금액을 투입해주세요. ==>"); money=s.nextInt(); change=money-coffee; System.out.printf("거스름 돈은 %d원 입니다.",change); int c500,c100,c50;..

방법 1 Scanner에 입력한 값을 500, 100, 50, 10 원짜리로 어떻게 바꿀 수 있는지 계산. import java.util.Scanner; public class Problem04_02 { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.print("## 교환할 돈은?"); int money=s.nextInt(); int c500, c100, c50, c10; c500=money/500; System.out.printf("500원짜리 ==> %d개\n",c500); money=money%500; //1380을 500으로 나눴을때 나머지 값은 380. c100=money/100; //38..

import java.util.Scanner; public class Problem04_01 { public static void main(String[] args) { Scanner s=new Scanner (System.in); System.out.print("첫번째 계산할 값을 입력하세요 ==>"); double a=s.nextDouble(); //실수니까 double 변수 사용 System.out.print("두번째 계산할 값을 입력하세요 ==>"); double b=s.nextDouble(); System.out.printf("%.2f + %.2f = %.2f\n",a,b,a+b); //.2는 소수점 2번째 자리까지만 나타냄을 의미 System.out.printf("%.2f - %.2f = %...
public static void main(String[] args) { Scanner s=new Scanner(System.in); int i; System.out.print("Input Words"); String str=s.nextLine(); for(i=str.length()-1;i>=0;i--) { System.out.printf("%c",str.charAt(i)); } } 입력된 문자열을 받기 위해 String 타입 변수 선언 필요. 출력은 맨 뒤에서 부터 하는 것이기 때문에 for문의 시작점은 입력한 문자의 맨 마지막 글자. .length() 는 입력된 문자열의 길이를 구하는 메소드. .charAt(i) 는 입력된 문자열에서 i번째에 있는 문자를 구하는 메소드. 자바에서 문자열이 입력되면 1..
public static void main(String[] args) { System.out.printf("byte형의 크기 ==> %d\n",Byte.SIZE); System.out.printf("short형의 크기 ==> %d\n",Short.SIZE); System.out.printf("int형의 크기 ==> %d\n",Integer.SIZE); System.out.printf("long형의 크기 ==> %d\n",Long.SIZE); System.out.printf("float형의 크기 ==> %d\n",Float.SIZE); System.out.printf("double형의 크기 ==> %d\n",Double.SIZE); System.out.printf("char형의 크기 ==> %d\n",Ch..