12월, 2022의 게시물 표시

오늘 뭐 먹지?

이미지
  기능:  엔터 누르면 메뉴가 랜덤으로 뜸. 마음에 안들 수 있어서 엔터 무한루프 가능. import java.io.IOException; public class Lunch { public static void main(String[] args) { String[] menu = { "샐러드", "분식", "김밥", "김치찌개", "돈까스", "굶기" }; int count = 0; while (true) { if(count == 0) { System.out.println("****************************\r\n" + "\r\n" + "        점심 v1.0\r\n" + "\r\n" + "       developed by Byul\r\n" + "****************************"); } System.out.println("오늘의 점심은? 엔터!"); try { System.in.read(); System.in.read(); } catch (IOException e) { e.printStackTrace(); } System.out.println("****************************\r\n" + "\r\n" + "        " + menu[(int) Math.floor(Math.random() * menu.length)] + "\r\n" + "\r\n" + "****************************");

포켓몬 스티커 뽑기 v1.0

이미지
  기능: 엔터를 누르면 빵을 먹고 스티커를 뽑음. 스티커 등급은  SS, S, A ~ F 까지 있음. 각 등급 안에는 포켓몬 종류가 여러가지 있음.  알고리즘: 스티커 등급 별 확률(int)들을 변수들에 저장. 스티커 등급 별 포켓몬(String)들을 배열들에 저장. if 문으로 SS에서 F 까지 순차적으로 가챠를 돌림. 돌리는 중 등급 확률에 컷 당하지 않으면 다음 함수로 빠져나감. 컷 당하면 다음 등급 확률로 넘어감. SS 에서 F까지 쭉 감. 다음 함수로 빠져나가면 해당하는 등급의 배열 중에서 랜덤으로 한 포켓몬을 뽑고 출력함. 프로그램 자동 재실행. 끝. Loader class: Main class: import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.SplittableRandom; public class Main { int SS = 1; int S = 30; int A = 59; int B = 160; int C = 170; int D = 180; int E = 190; int F = 210; String[] SSstickers = { "뮤", "뮤츠" }; String[] Sstickers = { "망나뇽", "파이어", "프리져", "썬더", "리자몽" }; String[] Astickers = { "잠만보", "메가프테라", "투구푸스", "암스타", "폴리곤" }; String[] Bstickers = { "부스터", "쥬피썬더", "샤미드", "라프라스", "갸라도스",

Grouping program v3.0

이미지
Update:       1. can now restart program anytime by pressing 1.     2. removed unnecessary information printed to the user. Refer to version 2.0 for Loader class. Main class: import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { private Scanner sc; int groups; int quotient; ArrayList<String> students; ArrayList<ArrayList<String>> result; public Main() { this.main(); } public void main() { this.printTitle(); this.print("Press Enter to Continue..."); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } this.print("How many groups?"); this.groups = Integer.parseInt(input()); this.print("Enter the names of the students"); this.print("Enter 0 when done"); this.print("Enter 1 to restart"); this.students = new ArrayList<String>(); while (true) { String name

Grouping program v2.0

이미지
Title Enter number of groups and names of students. Press 0 to stop entering. names: entered names shuffled names: self-explanatory modulus o or x: self-explanatory quotient: number of names to push into each group Program is restarted automatically after.  Updates from v1.0 1. now supports smart grouping mode. ex: dividing 19 people to 4 groups. result: 3 groups of 5 people and 1 group of 4 people. 2. automatic program reboot. Loader class Main class import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { private Scanner sc; int groups; int quotient; ArrayList<String> students; ArrayList<ArrayList<String>> result; public Main() { this.main(); } public void main() { this.printTitle(); this.print("Press Enter to Continue..."); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } this.print("How many groups?");

Grouping program v1.0

이미지
Loader class Main class import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { private Scanner sc; int groups; ArrayList<String> students; public Main() { main(); } public void main() { this.printTitle(); print("Press Enter to Continue..."); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } print("How many groups?"); groups = Integer.parseInt(input()); print("Enter the names of the students"); print("Enter 0 when done"); students = new ArrayList<String>(); while (true) { String name = input(); if (name.equals("0")) { break; } students.add(name); System.out.println(students); } this.grouping(); } private void grouping() { if (groups > students.size()) { print("group too big"); } else if (groups == students.size()) {

Text editing shortcuts that work on eclipse

  /* Moving the Cursor */ /* ctl + home - Move cursor to top * ctl + end - Move cursor to bottom * page up/down - Self-explanatory * */ /* Selecting Text */ /* shft + up/down - Select lines one at a time * shft + ctl + left/right - Select words * shft + home/end - Select before/after cursor in current line * shft + ctl + home/end - Select before/after cursor in entire text * shft + page up/down - select whole page before/after cursor * */

"変数宣言” 開発日記 12月27日2022年

이미지
1. コメントとは?その種類は?      プログラムに影響を与えずにソースコードの周りに書かれる解析。      Javaの場合、1列のソースコードは //で、2列以上は/**/で2種類のコメントで解析が書けます。 2. コメントはコンパイルの時どうなる?     無視される。 3. 何故インデントは必要?     可読性のため。 4. 変数とは?     数値や文字などの値を入れられる領域。 5. 変数宣言の意味は?     これから使用するデータを保存するための箱の種類と名前を用意すること。 6. 8種類のデータ 型は?     byte, short, int, long, float, double, boolean, char 7. int 型の範囲は?      -2,147,483,648 から 2,147,483,647 まで 8. int num; をメモリーで説明しなさい。     メモリーに4 byteの空間を確保して種類はint、名前はnumで宣言する。 9. 問題:国語、英語、数学の総点を含む変数を宣言してから、それぞれ75,60,100を代入して総点を出力しなさい。

"コンパイル” 開発日記 12月26日2022年

1. HelloWorldを出力するプログラムの過程を説明しなさい。 HDDに保存されているjavaプログラムがユーザーに実行される。 b. RAMにプログラムが上がる。 c. javaコンパイラーがプログラムをCPUがわかる言語に訳する。 d. .class拡張子の訳されたファイルが生成される。 e. cpuが訳されたそれを読んで実行する。 f. ユーザーが最初求めてた"HelloWorld"が出力される。 2. 以下のコマンドを説明しなさい。 javac  java コンパイルとは? javac: javaのプログラムをコンパイルするコマンド java: 指定されたプログラムを実行するコマンド RAM - 主記憶装置 HDD - 補助記憶装置 .class - バイトコード

cmd로 java 파일 실행

프로그램 있는 디렉토리로 이동하고 javac 프로그램이름.java java 클래스 이름  끝

JAVA Enter를 누르십시오

      try {         System.in.read();     } catch (IOException e) {         e.printStackTrace();     }

자바 기본 설정

JDK 설치   AdoptOpenJDK - Open source, prebuilt OpenJDK binaries OpenJDK11 체크 HotSpot JVM 체크 다운로드 정상 설치 확인: cmd 명령어: javac java -version 스프링 sts 다운로드: https://download.springsource.com/release/STS/3.9.11.RELEASE/dist/e4.14/spring-tool-suite-3.9.11.RELEASE-e4.14.0-win32-x86_64.zip
심심해서 만들어본 사물함 배정 프로그램 사물함 1개당 2명씩 총 10개 사물함에 총 20명 인원을 배정 <!DOCTYPE html> <html> <body> <div id="demo"></div> <script> const names = ["이름A", "이름B", "이름C", "이름D", "이름E", "이름F", "이름G", "이름H", "이름I", "이름J", "이름K", "이름L", "이름M", "이름N", "이름O", "이름P", "이름Q", "이름R", "이름S", "이름T"]; const lockers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let shuffledLockers = []; shuffledLockers = shuffle(lockers); let shuffledNames = []; shuffledNames = shuffle(names); let final = []; let realFinal = []; for(i = 0; i < lockers.length; i++) { final.push(" 사물함" + shuffledLockers[i] + " : " + shuffledNames[i]);     shuffledNames.splice(i,1); } for(i = 0; i < lockers.length; i++) { realFinal.push(final[i] + " , " + shuffledNames[i] + "