목록JAVA/Java SE (17)
develope_kkyu
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..
CafeMain.java import java.util.ArrayList; import java.util.Scanner; public class CafeMain { public static void main(String[] args) { Menu menu = new Menu(); Sales sales = new Sales(); Scanner s = new Scanner(System.in); while(true) { System.out.println("작업선택 [m:메뉴작업,o:주문관리,s:매출조회,'':종료]"); String op = s.nextLine(); if(op.equals("m")) { menu.control(); } else if(op.equals("o")){ Order order = new..
MyPoint.java public class MyPoint { public int x; public int y; MyPoint(int x, int y){ this.x = x; this.y = y; } public double getDistance(int i, int j) { double dis; dis = Math.sqrt((this.x-i)*(this.x-i) + (this.y-j)*(this.y-j)); return dis; } } MyPointExam.java public class MyPointExam { public static void main(String[] args) { //System.out.println(Math.sqrt(4));// 2.0*2.0 == 4 //System.out.pr..
public static void main(String[] args) { // 최대, 최소, 합계를 구하는 프로그램(함수를 이용) int max, min, sum; int [] arr1 = {1,5,3,8,2}; max = searchMax(arr1); min = searchMin(arr1); sum = doSum(arr1); System.out.printf("MAX = %d\n", max); System.out.printf("MIN = %d\n", min); System.out.printf("SUM = %d\n", sum); int [] arr2 = {10,20,5,30,1,-99,100}; max = searchMax(arr2); min = searchMin(arr2); sum = doSum(arr2..
// 홀수 단만 출력할 수 있도록 프로그램 변경. 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