10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10

Size: px
Start display at page:

Download "10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10"

Transcription

1 10/ URL : 10/8 1 / 10

2 10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10

3 10/8 Finder 1 Figure : : Apple.com 2, 3 / 10

4 10/8 Finder ( ) 1, CS 2 CS : Finder, Finder ( ) 4 / 10

5 10/8 Finder, 1 :, CS 5 / 10

6 10/8 Finder cd. cd CS., CS touch test.txt, CS text.txt. text.txt / 10

7 10/8 : cd CS ls pwd mv filea fileb mv filea FolderB cp filea fileb cp filea FolderB mkdir FolderA CS filea fileb filea FolderB filea fileb filea FolderB FolderA, Google 7 / 10

8 10/8 Java Web page quiz1.java quiz2.java CS webct, CS, Java javac quiz1.java return 8 / 10

9 10/8 java quiz1 return Input positive integer, ( ) 2 : 3 3 : quiz2.java, / 10

10 10/8 URL : 10/8, 10/8 PM 11:59 10 / 10

11 10/8 10/ URL : 10/22 1 / 16

12 10/8 10/22 1 I,.. JAVA,, JAVA 2 / 16

13 10/8 10/22 1 II, TA.. Java JAVA,. 3 / 16

14 10/8 10/22 1 III. Android. 4 / 16

15 10/8 10/22 JAVA JAVA,,,, if, for, while ( ) Copy & Paste. 5 / 16

16 10/8 10/22 Hello World! public class Hello public static void main String[] args System.out.println "Hello World!" ; Hello.java & javac Hello.java java Hello 1 Hello 3. 1 Hello Hello.java 6 / 16

17 10/8 10/22 Hello World! public class Hello public static void main String[] args System.out.println "Hello World!" ; ( 1) { } 1 { } 2 { } 2 4 tab 1 3 Hello World! "Hello World!", \"Hello World!" 7 / 16

18 10/8 10/ = 7 5 * 6 = 30 7 / 8 = / 8.0 = public class keisan public static void main String[] args System.out.println "3 + 4 = "+ (3+4) ; System.out.println "5 * 6 = "+ (5*6) ; System.out.println "7 / 8 = "+ (7/8) ; System.out.println "7.0 / 8.0 = "+ (7.0/8.0) ; 1 &. 8 / 16

19 10/8 10/22 System.out.println(" "); System.out.print(" "); : println print? public class keisan public static void main String[] args System.out.print "3 + 4 = "+ (3+4) ; System.out.print "5 * 6 = "+ (5*6) ; System.out.print "7 / 8 = "+ (7/8) ; System.out.print "7.0 / 8.0 = "+ (7.0/8.0) ; = = 307 / 8 = 07.0 / 8.0 = / 16

20 10/8 10/22???.java public class??? public static void main String[] args ( ) System.out.println ( ), System.out.println(" "); System.out.print(" "); A B, + /! 10 / 16

21 10/8 10/22 :,, ( x 4 int x; x = 4; int x = 4; :, x 3 int x = 4; x = 3; 11 / 16

22 10/8 10/22 ( x 4.0 double x; x = 4.0; double x = 4.0; :, x 3.5 double x = 4.0; x = 3.5; ( x c char x; x = c ; char x = c ; 12 / 16

23 10/8 10/22 2 :, x, y. sample.java. int x = 10 x = x 1 // (1) x x = x*x // (2) x double y = 5.5 y = x*y // (3) y 13 / 16

24 10/8 10/22 ( ) ( import java.util.scanner // public class ( ) Scanner input = new Scanner System.in int N = input.nextint, N ( import java.util.scanner // public class ( ) Scanner input = new Scanner System.in ; double x = input.nextdouble ;, x 14 / 16

25 10/8 10/22 3 : keisan3.java. x y 1. x = y = x + y = x * y = x / y = 15 / 16

26 10/8 10/22 URL : 10/22, 10/22 PM 11:59 16 / 16

27 10/22 10/ URL : 10/29 1 / 21

28 10/22 10/29 10/22 10/29 10/22 2., or.,, 2 / 21

29 10/22 10/29 1 :, (double quotation). 3 / 21

30 10/22 10/29 2 :, System.out.println 4 / 21

31 10/22 10/29 JAVA 2 JAVA,,,, if, for, while ( ) Copy & Paste. 5 / 21

32 10/22 10/29 (int) 2. 1bit 0 1 nbit ( 1) s n 1, s, a 1,..., a n 1 {0, 1}, a i 2 i i=1 32bit, bit, / 21

33 10/22 10/29 (double), 64bit. s e e e e m m m m m s, e(11 ), m(52 ) x = ( 1) s 2 e 1023 ( i=1. x = 0.1 d i 2 i ) 7 / 21

34 10/22 10/29 : int x = 1; x = x + 1.0; x int 1.0 double ( ) I int x = 1; x = x + (int)1.0; // x = 2 double int = int x = 1; x = x + (int)1.75; // / 21

35 10/22 10/29 ( ) II x = 7/8; // x 0 x = (double)7/(double)8; // x x = 7.0/8; // x x = 7.0/8.0; // x : double, double., double y = 1.0; // y = 1; y = 2.0 * Math.sin(Math.PI/2.0); // y = 2*Math.sin(Math.PI/2); 9 / 21

36 10/22 10/29 if if : if ( ) { true ; } true, false 1 : p... int p;... if (p >= 50) { System.out.println("It will rain today."); } 10 / 21

37 10/22 10/29 if : if ( ) { true ; }else{ false ; } 2 : p... int p;... if (p >= 50) { System.out.println("Need an umbrella."); }else{ System.out.println("Not need an umbrella."); } 11 / 21

38 10/22 10/29 if : if ( A) { A true ; }else if ( B){ B true ; }else{ A B false ; } 3 : p... if (p >= 0 && p<=20) { System.out.println("Sunny!"); }else if(p > 20 && p <=50 ){ System.out.println("Cloudy."); }else{ System.out.println("Rainy."); } 12 / 21

39 10/22 10/29 if : Tabelle: if Java p == 50 p = 50 p 50 true, false p!= 50 p 50 p 50 true, false p >= 50 p 50 p 50 true, false p <= 50 p 50 p 50 true, false p > 50 p > 50 p 50 true, false p < 50 p < 50 p 50 true, false p >= 0 && p <= 20, 0 p p 20 p >= 40 p <= 20, p 40 p / 21

40 10/22 10/29 10/8 if(n % 3 == 0 && N % 5 == 0){ System.out.println("FizzBuzz"); }else if(n % 3 == 0){ System.out.println("Fizz"); }else if(n % 5 == 0){ System.out.println("Buzz"); }else{ System.out.println(N); } N, FizzBuzz : N % 3 N 3 14 / 21

41 10/22 10/29 docs/api/java/lang/math.html) I : double x = Math.random(); // 0 1 int y = (int) (9*Math.random()); // 0 8 double z = 2*Math.random()-1.0; // -1 1 double x = Math.abs(-3.0);, double x = Math.sqrt(2.0); double y = Math.cbrt(2.0); 15 / 21

42 10/22 10/29 docs/api/java/lang/math.html) II, log e double x = Math.pow(1.5, 6);// double y = Math.log(1.3); sin(x), cos(x), tan(x) double x = Math.sin(2.0); double y = Math.cos(Math.PI/2.0); double z = Math.tan(-Math.PI); arcsin(x), arccos(x), arctan(x) double x = Math.asin(0.5); double y = Math.acos(0.5); double z = Math.atan(-10); 16 / 21

43 10/22 10/29 docs/api/java/lang/math.html) III π, e double x = Math.PI; double y = Math.E;, double x = Math.ceil(1.5); double y = Math.floor(1.5); 17 / 21

44 10/22 10/29 1 : double d = Math.random();,. Omikuji.java. d < 0.1, Great blessing 0.1 d < 0.3, Small blessing 0.3 d < 0.5, Blessing 0.5 d < 0.7, Curse 0.7 d < 0.9, Small curse 0.9 d < 1.0, Great curse d 18 / 21

45 10/22 10/29 2 : π Java π. pi.java. (Machin ) π ( ) ( ) 1 1 = 4 arctan arctan, (Euler ) π ( ) ( ) 1 3 = 5 arctan + 2 arctan, (Stormer ) π ( ) ( ) ( ) = 6 arctan + 2 arctan + arctan double p1 = 4*Math.atan(1.0/5.0)-Math.atan(1.0/239.0); // Machin... System.out.println("Machin = "+ (p1*4));... System.out.println("PI = "+Math.PI); 19 / 21

46 10/22 10/29 3 : N(, 2500 ),. leap.java. (Wikipedia ): N 4, (N 4 ) N 100, (N ) N 400, (N ) N 400, Input a positive integer :101 Not leap Input a positive integer :204 Leap Input a positive integer :100 Not leap Input a positive integer :1200 Leap 20 / 21

47 10/22 10/29 URL : 10/29, 10/29 PM 11:59 21 / 21

48 10/29 11/ URL : 11/5 1 / 13

49 10/29 11/5 10/29.,,. Omikuji.java leap.java if. Omikuji.java if(d < 0.1){ System.out.println("Great blessing"); }else if(d < 0.3){ System.out.println("Small blessing");...( )... }else if(d < 1.0){ System.out.println("Great curse"); } System.out.println("d = "+d); } 2 / 13

50 10/29 11/5 JAVA 3 JAVA,,,, if, for, while ( ) Copy & Paste. 3 / 13

51 10/29 11/5 for ( ) π 4 = ( 1) n 2n + 1 n=0,, π/4 : p N = N n=0 ( 1) n 2n + 1 π 4 (N ), N = 0 N = 6 4 / 13

52 10/29 11/5 double p = 1.0; // N=0 System.out.println("p = "+p); p = p - 1.0/3.0; // N = 1 System.out.println("p = "+p); p = p + 1.0/5.0; // N = 2 System.out.println("p = "+p); p = p - 1.0/7.0; // N = 3 System.out.println("p = "+p); p = p + 1.0/9.0; // N = 4 System.out.println("p = "+p); p = p - 1.0/11.0; // N = 5 System.out.println("p = "+p); p = p + 1.0/13.0; // N = 6 System.out.println("p = "+p); p ( 1) n /(2n + 1) N = 10 5 / 13

53 10/29 11/5 for... double p = 1.0; // N = 0 int N = 10; // N=10 for(int n=1; n < N+1; n++){ if(n % 2 == 0){ p = p + 1.0/(2*n+1); }else{ p = p - 1.0/(2*n+1); } System.out.println("p = "+p); } 6 / 13

54 10/29 11/5 for for( ; ; ){ ( ); } 1 : 0 99 for(int i=0; i<100; i++){ System.out.println("i = "+i); } 1 i=0 i<100 i=0 i=i+1 i=1 2 i=1 i<100 i=1 i=i+1 i=2 3 4 i=100 i<100 7 / 13

55 10/29 11/5 for : for( ; ; ){ ( ); } 2 : 10 k=1 k int sum = 0; for(int k=1; k<=10; k++){ sum = sum + k; } 1 k=1 k<=10 sum = 1 k=k+1 k=2 2 k=2 k<=10 sum = 3 k=k+1 k=3 3 4 k=11 k<=10 8 / 13

56 10/29 11/5 for 3 : DrawGraph1.java public class DrawGraph1{ public static void main(string[] args){ for(int i=0; i<10; i++){ System.out.print(i +":"); for(int j=0; j<i; j++){ System.out.print("*"); } System.out.println(""); } } } for for j < i for, i i, j 9 / 13

57 10/29 11/5 1 : ( ) 1 N, N!. factorial.java. N! := N (N 1) : 2 N, N. divisor.java. Input a positive integer : Input a positive integer : / 13

58 10/29 11/5 3 : ( for I). Kuku.java. 3 1*1=1, 1*2=2, 1*3=3, 1*4=4, 1*5=5, 1*6=6, 1*7=7, 1*8=8, 1*9=9, 2*1=2, 2*2=4, 2*3=6, 2*4=8, 2*5=10, 2*6=12, 2*7=14, 2*8=16, 2*9=18, 3*1=3, 3*2=6, 3*3=9, 3*4=12, 3*5=15, 3*6=18, 3*7=21, 3*8=24, 3*9=27, 4*1=4, 4*2=8, 4*3=12, 4*4=16, 4*5=20, 4*6=24, 4*7=28, 4*8=32, 4*9=36, 5*1=5, 5*2=10, 5*3=15, 5*4=20, 5*5=25, 5*6=30, 5*7=35, 5*8=40, 5*9=45, 6*1=6, 6*2=12, 6*3=18, 6*4=24, 6*5=30, 6*6=36, 6*7=42, 6*8=48, 6*9=54, 7*1=7, 7*2=14, 7*3=21, 7*4=28, 7*5=35, 7*6=42, 7*7=49, 7*8=56, 7*9=63, 8*1=8, 8*2=16, 8*3=24, 8*4=32, 8*5=40, 8*6=48, 8*7=56, 8*8=64, 8*9=72, 9*1=9, 9*2=18, 9*3=27, 9*4=36, 9*5=45, 9*6=54, 9*7=63, 9*8=72, 9*9=81, 11 / 13

59 10/29 11/5 3 :??? for(int i=0;???; i++){ for(int j=0;???; j++){???; }???; }, System.out.println System.out.print 12 / 13

60 10/29 11/5 URL : 11/5, 11/5 PM 11:59 13 / 13

61 11/5 11/ URL : 11/12 1 / 11

62 11/5 11/12. public class divisor { public static void main (String[] args){ int n = 1; for(int a = 1; a<=n; n++){ if(n%a==0){ System.out.println(a); } } } } 2 / 11

63 11/5 11/12 Control c for 3 / 11

64 11/5 11/12 JAVA 4 JAVA,,,, if, for, while ( ) Copy & Paste. 4 / 11

65 11/5 11/12 while while : while( ){ ( ); } 1 : i=0,..., 99 int i = 0; while(i < 100){ System.out.println("i = "+i); i = i + 1; } 1 i = 0 while i = 0 i=1 2 i = 1 while i = 1 i=2 3 4 i = 100 while 5 / 11

66 11/5 11/12 2 : x = double x = 100.0; int c = 0; while(x <= 200){ x = x * 1.08; c = c + 1; } System.out.println("c = "+c); 1 x = while x = 108.0, c = 1 2 x = while x = , c = x = while while 5 c = 10 6 / 11

67 11/5 11/12 while : while( ){ ( ); } do while : do{ ( ); }while( );, while(true){... } break,. ctrl-c. 7 / 11

68 11/5 11/12 for, while for while. for while., for, while 8 / 11

69 11/5 11/12 1 : 0,, 0. inputintsum.java. import java.util.scanner;... while( ){ scanner input = new Scanner(System.in); System.out.print("Input an integer :"); N = input.nextint(); ( ); },. N int while. do-while? 9 / 11

70 11/5 11/12 1 Input a positive integer :10 Input a positive integer :20 Input a positive integer :1 Input a positive integer :0 sum = 31 Input a positive integer :13 Input a positive integer :-2 Input a positive integer :4 Input a positive integer :0 sum = / 11

71 11/5 11/12 2 : ( ) γ γ N (, N ): γ N := N k=1 1 k log(n). while, γ N γ N 1 ϵ N.,, ϵ = ϵ = 10 6 double eps = 1.0e-6;. eulersconst.java., lim N γ N = / 11

72 11/5 11/12 URL : 11/12, 11/12 PM 11:59 12 / 11

r1.dvi

r1.dvi 2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println(Hello World); (Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0

More information

2

2 問題 次の設問に答えよ 設問. Java のソースコードをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) javaw 設問. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d).jar 設問. Java のソースコードの拡張子はどれか a).c b).java c).class

More information

明解Java入門編

明解Java入門編 1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");

More information

2

2 問題 1 次の設問 1~5 に答えよ 設問 1. Java のソースプログラムをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 2. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 3. Java のソースプログラムの拡張子はどれか a).c

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 3 章 探索 Arrays.binarySearch 743 3-1 探索 探索 searching key 配列 探索 Fig.3-1 b c 75 a 6 4 3 2 1 9 8 2 b 64 23 53 65 75 21 3-1 53 c 5 2 1 4 3 7 4 Fig.3-1 a 763 3-2 線形探索 線形探索 linear search sequential search 2

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");

More information

デジタル表現論・第6回

デジタル表現論・第6回 デジタル表現論 第 6 回 劉雪峰 ( リュウシュウフォン ) 2016 年 5 月 16 日 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 6 回 2016 年 5 月 16 日 1 / 16 本日の目標 Java プログラミングの基礎配列 ( 復習 関数の値を配列に格納する ) 文字列ファイルの書き込み 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 6 回 2016 年

More information

デジタル表現論・第4回

デジタル表現論・第4回 デジタル表現論 第 4 回 劉雪峰 ( リュウシュウフォン ) 2016 年 5 月 2 日 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 1 / 14 本日の目標 Java プログラミングの基礎 出力の復習 メソッドの定義と使用 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 2 / 14 出力 Systemoutprint()

More information

Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk

Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 1-1 32bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk-8u65-windows-i586.exe 2. jre-8u65-windows-i586.exe

More information

8 if switch for while do while 2

8 if switch for while do while 2 (Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else

More information

: : : TSTank 2

: : : TSTank 2 Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

新・明解Java入門

新・明解Java入門 537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,

More information

Microsoft Word - keisankigairon.ch doc

Microsoft Word - keisankigairon.ch doc 1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3

More information

Java演習(2) -- 簡単なプログラム --

Java演習(2)   -- 簡単なプログラム -- Java public class Hello Hello (class) (field)... (method)... Java main Hello World(Hello.java) public class Hello { public static void main(string[ ] args) { public() (package) Hello World(Hello.java)

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致致しない場合 default: から直後の まで処理します 式の結果 ラベル 定数 整数または文字 (byte, short, int,

More information

新・明解Java入門

新・明解Java入門 第 1 章 画面 文字 表示 Java Java Java Java Java JRE Java JDK 21 1-1 Java Java Java Java 誕生 Fig.1-1 Oak Java Sun Microsystems 2010 Oracle Java Oracle 4 Java http://www.java.com/ http://www.alice.org/ Fig.1-1Java

More information

Method(C 言語では関数と呼ぶ ) メソッドを使うと 処理を纏めて管理することができる 処理 ( メソッド ) の再実行 ( 再利用 ) が簡単にできる y 元々はC 言語の関数であり 入力値に対する値を 定義するもの 数学では F(x) = 2x + 1 など F(x)=2x+1 入力値 (

Method(C 言語では関数と呼ぶ ) メソッドを使うと 処理を纏めて管理することができる 処理 ( メソッド ) の再実行 ( 再利用 ) が簡単にできる y 元々はC 言語の関数であり 入力値に対する値を 定義するもの 数学では F(x) = 2x + 1 など F(x)=2x+1 入力値 ( Method(C 言語では関数と呼ぶ ) メソッドを使うと 処理を纏めて管理することができる 処理 ( メソッド ) の再実行 ( 再利用 ) が簡単にできる y 元々はC 言語の関数であり 入力値に対する値を 定義するもの 数学では F(x) = 2x + 1 など F(x)=2x+1 入力値 ( 引数 ) x が決まれば F(x) が決まる これを応用して 複雑な処理も 外面的にはひと固まりの処理として扱う

More information

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文 Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文字 0x0000 ~ 0xffff byte 1バイト整数 - 2 8 ~ 2 8-1 short 2バイト整数

More information

スライド 1

スライド 1 第 4 回データの入出力 情報科学部情報メディア学科 鈴木基之 1 前回の演習の答え class CalcMean { public static void main(string[] args){ int a = 10, b = 15; double f; f = ( a + b ) / 2; System.out.println(f); f = ( a + b ) / 2.0; System.out.println(f);

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション オブジェクト指向 プログラミング演習 第 2 回クラス インスタンス メソッド フィールド コンストラクタ ICPC の宣伝 国際大学対抗プログラミングコンテスト 3 人一組のチームでプログラムを書く速さを競う 国内予選 : ネットワーク上で 6 月末 ~7 月頭 アジア地区予選 : 日本国内で秋に開催 世界大会 :2020 年は 6 月にモスクワで 参加登録締切 : 国内予選の 2~3 週間前 今年は

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

Java講座

Java講座 ~ 第 1 回 ~ 情報科学部コンピュータ科学科 2 年竹中優 プログラムを書く上で Hello world 基礎事項 演算子 構文 2 コメントアウト (//, /* */, /** */) をしよう! インデントをしよう! 変数などにはわかりやすい名前をつけよう! 要するに 他人が見て理解しやすいコードを書こうということです 3 1. Eclipse を起動 2. ファイル 新規 javaプロジェクト

More information

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1 Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of

More information

コーディング基準.PDF

コーディング基準.PDF Java Java Java Java.java.class 1 private public package import / //////////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////////////

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information

I java A

I java A I java 065762A 19.6.22 19.6.22 19.6.22 1 1 Level 1 3 1.1 Kouza....................................... 3 1.2 Kouza....................................... 4 1.3..........................................

More information

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な 問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値なので 水量を 1m 3 ずつ増やして料金を加算していく簡単なアルゴリズムでも大丈夫です 具体的には 使用水量

More information

Javaによるアルゴリズムとデータ構造

Javaによるアルゴリズムとデータ構造 1 algorithm List 1-1 a, b, c List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); int a, b, c; int max; // Chap01/Max3.java

More information

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb " # $ % & ' ( ) * +, -. / 0 1 2 3 4 5 6 7 8 9 : ; < = >? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y " # $ % & ' ( ) * + , -. / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B

More information

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 (

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 ( 本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 ( 知識 4 択 :20 問 ) 1.Java 言語ソースプログラムの拡張子は何か 1 java 2 class

More information

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の break; までを処理し どれにも一致しない場合 default; から直後の break; までを処理する 但し 式や値 1

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の break; までを処理し どれにも一致しない場合 default; から直後の break; までを処理する 但し 式や値 1 Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の までを処理し どれにも一致しない場合 default; から直後の までを処理する 但し 式や値 1 値 2は整数または文字である switch( 式 ) case 値 1: // コロン : です セミコロン ; と間違えないように!!

More information

問題1 以下に示すプログラムは、次の処理をするプログラムである

問題1 以下に示すプログラムは、次の処理をするプログラムである 問題 1 次に示すプログラムは 配列 a の値を乱数で設定し 配列 a の値が 333 より大きく 667 以下の値 の合計値を求めるプログラムである 1 と 2 に適切なコードを記述してプログラムを完 成させよ class TotalNumber { public static void main(string[] args) { int[] a = new int[1000]; // 1 解答条件

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2005 7 22 22 (sakai.keiichi@kochi sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2005/index.html tech.ac.jp/k1sakai/lecture/alg/2005/index.html f(0) = 1, f(x) =

More information

ALG ppt

ALG ppt 2012 7 5 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html (198 ) f(p) p 2 1 2 f 2 53 12 41 69 11 2 84 28 31 63 97 58 76 19 91 88 53 69 69 11 84 84 63

More information

Microsoft Word - java a.doc

Microsoft Word - java a.doc 4 入出力の基本として ディスプレイへの文字出力と キーボードからの文字入力の方法を学びます 入出力とは何か 標準出力 標準入力 43 4.1. 入出力とは プログラムと外部機器の間でデータをやりとりすることをいいます プログラムから出て行く方向が 出力 プログラムに入って来る方向が 入力 です 出力 外部機器 プログラム 入力 外部機器 外部機器はさまざまな種類があります 出力を行うには ディスプレイ

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 4 回 繰り返し (for ループ ) 授業開始前に ログオンして待機して ください Java 1 第 4 回 2 不要ファイルの掃除 前回デスクトップにファイルをダウンロードした場合 次のものを削除してください week03.zip デスクトップにファイルを置きすぎると コンピュータをシャットダウンできなくなります Java 1 第 4 回 3 授業を始めます 前回の課題は

More information

問題1 以下に示すプログラムは、次の処理をするプログラムである

問題1 以下に示すプログラムは、次の処理をするプログラムである 問題 1 次のプログラムの出力結果を a~d の中から選べ public class Problem1 { int i=2; int j=3; System.out.println("i"+j); a) 23,b) 5,c) i3,d) ij 問題 2 次のプログラムの出力結果を a~d の中から選べ public class Problem2 { int a=6; if((a>=2)&&(a

More information

break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati

break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致しない場合 default: から直後の まで処理します 式は byte, short, int, char 型 ( 文字または整数 ) を演算結果としますラベルには整数リテラル

More information

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A Java 3 p.1 3 Java Java if for while C 3.1 if Java if C if if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { Q 3.1.1 1. int n = 2; if (n

More information

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; 19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(

More information

Assignment_.java 課題 : 転置行列 / class Assignment_ public static void main(string[] args) int i,j; int[][] array = 1,,,,,,,,,,,,,1,1,; 行 列行列 i

Assignment_.java 課題 : 転置行列 / class Assignment_ public static void main(string[] args) int i,j; int[][] array = 1,,,,,,,,,,,,,1,1,; 行 列行列 i 1 1 0 1 Assignment_1.java 課題 1: チェッカー / class Assignment_1 public static void main(string[] args) int i,j; チェッカー用の 次元配列 int[][] checker=new int[][]; チェッカーパターンを書き込む for(i=0;i

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。 解答例 問題 1 変数 a が 3 以上でかつ 7 以下の場合 true と表示し そうでない場合は false と表示するプログラムである public class Prog061004_01 { int a; boolean b; a = Integer.parseInt(buf.readLine()); b = (a >= 3) && (a

More information

プログラミングA

プログラミングA プログラミング A 第 10 回 演習 2015 年 6 月 29 日 東邦大学金岡晃 本日の内容 中間テストの解説 演習 1 2015/6/29 プログラミング A 中間テスト解説 : 問 1 < 問 1> 下記の命令が実行された後の a の値を書きなさい ( 省略 ). int a=13; 答え : 13 2 中間テスト解説 : 問 2 < 問 2> 下記の命令が実行された後の a の値を書きなさい

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション "# "# $%&' "#$% $# & $# $% % ' ()(*"#$% +,(- ()(*"#$%.' ()(* $/.0##'' %0$&0% 1*2#/0/%'&0343$56 789#/0/'%&04../ "3"0##"$ "0%0$" "7 1*2#.30///04%.$ 789#.30///0#$'4 http://www.ibie2016.com/exhibitorlist/

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または

More information

JAVA 11.4 PrintWriter 11.5

JAVA 11.4 PrintWriter 11.5 JAVA 11.4 PrintWriter 11.5 PrintWriter Writer Int, float, char Object print() println() tostring() PrintWriter PrintWriter(OutputStream outputstream) PrintWriter(OutputStream outputstream, boolean flushonnewline)

More information

Microsoft PowerPoint - prog03.ppt

Microsoft PowerPoint - prog03.ppt プログラミング言語 3 第 03 回 (2007 年 10 月 08 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/33 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 10 月 08 日分と書いてある部分が 本日の教材です

More information

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 Java (7) 2008-05-20 1 Lesson 5 1.1 5 3 = (1) 1 m 3 /s 1 2 3 10 m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 1.2 java 2 1. 2. 3. 4. 3 2 1.3 i =1, 2, 3 V i (t) 1 t h i (t) i F, k

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value = Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

More information

プログラミング基礎I(再)

プログラミング基礎I(再) 山 元 進 1 度 は 講 義 を 受 けたことを 念 頭 に 置 いて 講 義 遠 慮 なく 質 問 せよ 質 問 で 授 業 を 止 めたくないならば TA の 人 を 呼 んで 質 問 すると 良 い 前 期 講 義 の 欠 席 者 は 特 に 注 意 せよ 4 限 座 学 +5 限 演 習 出 席 をとる( 前 期 同 様 のシステム) 中 間 試 験 を 行 う 期 末 試 験 の 範 囲

More information

Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲

Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲 Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲を決定します 次の型が利用でき これらの型は特に基本型とよばれます 基本型 値の種類 値の範囲 boolean

More information

ALG2012-C.ppt

ALG2012-C.ppt 2012717 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 1. 2. 2 .. 3 public class WeightedNode { private E value; // private Map

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 5 回 繰り返し (while ループ ) 授業開始前に ログオン後 不要なファイルを削除し て待機してください Java 1 第 5 回 2 参考書について 参考書は自分にあったものをぜひ手元において自習してください 授業の WEB 教材は勉強の入り口へみなさんを案内するのが目的でつくられている これで十分という訳ではない 第 1 回に紹介した本以外にも良書がたくさんある

More information

r02.dvi

r02.dvi 172 2017.7.16 1 1.1? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X ( ) 1.2 1 2-0 ( ) ( ) ( ) (12) ( ) (112) (131) 281 26 1 (syntax) (semantics) ( ) 2 2.1 BNF BNF(Backus Normal Form) Joun Backus (grammer) English

More information

ohp02.dvi

ohp02.dvi 172 2017.7.16 1 ? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X 2 ( ) 3 2-0 ( ) ( ) ( ) (12) ( ) (112) 31) 281 26 1 4 (syntax) (semantics) ( ) 5 BNF BNF(Backus Normal Form) Joun Backus (grammer) English grammer

More information

情報処理Ⅰ

情報処理Ⅰ Java フローチャート -1- フローチャート ( 流れ図 ) プログラムの処理手順 ( アルゴリズム ) を図示したもの 記号の種類は下記のとおり 端子記号 ( 開始 終了 ) 処理記号計算, 代入等 条件の判定 条件 No ループ処理 LOOP start Yes データの入力 出力 print など 定義済み処理処理名 end サンプルグログラム ( 大文字 小文字変換 ) 大文字を入力して下さい

More information

untitled

untitled 2011 7 21 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2011/index.html tech.ac.jp/k1sakai/lecture/alg/2011/index.html html 1 5 2 3 4 - 5 .. 6 - 7 public class KnapsackBB

More information

22 200702894 1 1 3 2 4 2.1..................................... 4 2.1.1............................. 4 2.1.2............................. 4 2.2................................... 9 2.2.1...................................

More information

Microsoft Word - NonGenTree.doc

Microsoft Word - NonGenTree.doc ジェネリクスとコンパレータを使用しない 2 分探索木のプログラム例 BinTreeNG.java: 2 分探索木のクラス BinTreeNG BinTreeTesterNG.java: BinTreeNG を利用するプログラム例 === BinTreeNG.java =========================================================================

More information

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。 ソフトウェア基礎演習課題 文法理解度確認範囲 問題 1 データ型 ( 変数, データ型 ) 問題 2 制御構造 (switch 文 ) 問題 3 制御構造 (while 文 ) 問題 4 制御構造と配列 ( 総和 ) 問題 5 制御構造と配列 ( 総和, 平均 ) 問題 6 データ型と各種演算子 ( 文字列, 検索 ) 問題 7 クラスの定義 ( メソッドの定義, コンストラクタの定義, キャスト

More information

Microsoft PowerPoint - java13bb.ppt

Microsoft PowerPoint - java13bb.ppt 平 成 25 年 度 静 岡 県 立 大 学 公 開 講 座 Javaで 学 ぶプログラミング 基 礎 第 1 回 Java 言 語 の 概 要 第 2 回 Javaプログラミングの 基 礎 第 3 回 コンソール アプリケーション 作 成 第 4 回 Androidアプリケーション 作 成 JavaとJava 仮 想 マシン Javaとは Sun Microsystems によって 開 発 された

More information

Quick Sort 計算機アルゴリズム特論 :2017 年度 只木進一

Quick Sort 計算機アルゴリズム特論 :2017 年度 只木進一 Quick Sort 計算機アルゴリズム特論 :2017 年度 只木進一 2 基本的考え方 リスト ( あるいは配列 )SS の中の ある要素 xx(pivot) を選択 xx より小さい要素からなる部分リスト SS 1 xx より大きい要素からなる部分リスト SS 2 xx は SS 1 または SS 2 に含まれる 長さが 1 になるまで繰り返す pivot xx の選び方として 中央の要素を選択すると効率が良い

More information

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) flow Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1

More information

ohp07.dvi

ohp07.dvi 17 7 (2) 2017.9.13 1 BNF BNF ( ) ( ) 0 ( ) + 1 ( ) ( ) [ ] BNF BNF BNF prog ::= ( stat ) stat ::= ident = expr ; read ident ; print expr ; if ( expr ) stat while ( expr ) stat { prog expr ::= term ( +

More information

text_08.dvi

text_08.dvi C 8 12 6 6 8 Java (3) 1 8.1 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 8.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value = Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value

More information

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java 1 Java Java 1.1 Java 1) 2) 3) Java OS Java 1.3 4) Java Web Start Web / 5) Java C C++ Java JSP(Java Server Pages) 1) OS 2) 3) 4) Java Write Once, Run Anywhere 5) Java Web Java 2 1 Web Java Android Java

More information

(2000 )

(2000 ) (000) < > = = = (BC 67» BC 1) 3.14 10 (= ) 18 ( 00 ) ( ¼"½ '"½ &) ¼ 18 ¼ 0 ¼ =3:141596535897933846 ¼ 1 5cm ` ¼ = ` 5 = ` 10 () ` =10¼ (cm) (1) 3cm () r () () (1) r () r 1 4 (3) r, 60 ± 1 < > µ AB ` µ ±

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または

More information

Informatics 2010.key

Informatics 2010.key http://math.sci.hiroshima-u.ac.jp/ ~ryo/lectures/informatics2010/ 1 2 C ATM etc. etc. (Personal Computer) 3 4 Input Output Device Central Processing Unit I/O CPU Memory 5 6 (CPU),,... etc. C, Java, Fortran...

More information

2.2 Java C main Java main 2 C 6 C Java 3 C Java ( ) G101Hello.java G101Hello main G101Hello.java /* G101Hello */ class G101Hello { /* main */ public s

2.2 Java C main Java main 2 C 6 C Java 3 C Java ( ) G101Hello.java G101Hello main G101Hello.java /* G101Hello */ class G101Hello { /* main */ public s 2 2013 4 16 2.1............................... 2 1 2.2 Java......................... 2 2 2.3............. 2 2 2.4................................ 2 4 2.5............................ 2 5 2.6............................

More information

Javaセキュアコーディングセミナー東京 第3回 入出力(File, Stream)と例外時の動作 演習解説

Javaセキュアコーディングセミナー東京 第3回 入出力(File, Stream)と例外時の動作 演習解説 Java セキュアコーディングセミナー東京第 3 回入出力と例外時の動作 演習解説 2012 年 11 月 11 日 ( 日 ) JPCERT コーディネーションセンター脆弱性解析チーム戸田洋三 1 Hands-on Exercises コンパイルエラーに対処しよう ファイルからのデータ入力を実装しよう 2 Hands-on Exercise(1) サンプルコードの コンパイルエラーに対処しよう 3

More information

2

2 2014/01/15 プログラミング応用 b H24 年度期末テスト問題 問題 1 次の設問 1,2 に答えよ 設問 1 1 から 10 まで数えながら その数が偶数か奇数かを表示する JAVA プログラムの一部である 空欄に入るべき文字列は何か for( int i=1; 1 ; i++){ System.out.print(i); if( 2 == 0){ System.out.println("

More information

2

2 Haskell ( ) kazu@iij.ad.jp 1 2 Blub Paul Graham http://practical-scheme.net/trans/beating-the-averages-j.html Blub Blub Blub Blub 3 Haskell Sebastian Sylvan http://www.haskell.org/haskellwiki/why_haskell_matters...

More information

ALG2012-F.ppt

ALG2012-F.ppt 2012 7 26 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 5 2 3 4 - 5 .. 6 - 7 public class KnapsackBB { // 0-1 private static double maxsofar; private

More information

text_11.dvi

text_11.dvi C 11 12 6 25 11 Java (6) ( ) 1 11.1 11 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 11.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 12 回目クラス 今日の講義で学ぶ内容 クラスとは クラスの宣言と利用 クラスの応用 クラス クラスとは 異なる複数の型の変数を内部にもつ型です 直観的に表現すると int 型や double 型は 1 1 つの値を管理できます int 型の変数 配列型は 2 5 8 6 3 7 同じ型の複数の変数を管理できます 配列型の変数 ( 配列変数 ) クラスは double

More information

マークアップ言語

マークアップ言語 東北大学全学教育科目 情報基礎 B 1 セメスター金曜 2 講時工学部 15, 16 組 JAVA 言語初級プログラム (f( f or ループ ) 建築 社会環境工学科 このスライド週の内容 for 文 ( 繰り返し文 ) break 文 情報基礎 B 2 for による繰り返し 以前,1 から 10 まで足すプログラムを作った. 同じ処理を 10 回繰り返すために, 同じような命令 ( 式 )

More information

Prog1_3rd

Prog1_3rd 2019 年 10 月 10 日 ( 木 ) 実施 プログラムの制御構造 1960 年代後半にダイクストラが提唱した構造化プログラミングという考え方では, 手続き型のプログラムを記述する際には, 順次, 選択, 反復という標準的な制御構造のみを用い, 先ずプログラムの概略構造を設計し, その大まかな単位を段階的に詳細化して処理を記述していく 順次構造順次構造とは, プログラム中の文を処理していく順に記述したものである

More information

10K pdf

10K pdf #1 #2 Java class Circle { double x; // x double y; // y double radius; // void set(double tx, double ty){ x = tx; y = ty; void set(double tx, double ty, double r) { x = tx; y = ty; radius = r; // Circle

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 2 回 式 型 変数 授業開始前に ログオンして待機して ください Java 1 第 2 回 2 不要ファイルの掃除 前回デスクトップにファイルをダウンロードした場合 次のものを削除してください jtaf.zip week01.zip デスクトップにファイルを置きすぎると コンピュータをシャットダウンできなくなります Java 1 第 2 回 3 授業を始めます 前回の課題は

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 4 回目演算子 今日の講義で学ぶ内容 演算子とオペランド 式 様々な演算子 代表的な演算子の使用例 演算子とオペランド 演算子 演算の種類です例えば + - * / 掛け算の記号は ではなく *( アスタリスク ) を使います割り算の記号は ではなく /( スラッシュ ) を使います オペランド 演算の対象です例えば 5( 値 ) num( 変数 ) 式 演算子とオペランドの組み合わせにより構成される数式です式は演算結果をもちます

More information

プログラムの基本構成

プログラムの基本構成 Java 入門 この 2 回 ( 今回と次回 ) が勝負だ! プログラムは自転車の練習と同じだ! 今日の予定先ず プログラムの構造を学び (p.2~6) jcpad でプログラム ( 計算機実習室 ) 戻ってきてプログラムの解読手書きプログラムを TA にみてもらい OK の出た人は計算機実習室でプログラム作成し実行実行結果を TA がチェックして帰り プログラムの基本構成 Step1: 入力 Step2:

More information

文字列操作と正規表現

文字列操作と正規表現 文字列操作と正規表現 オブジェクト指向プログラミング特論 2018 年度只木進一 : 工学系研究科 2 文字列と文字列クラス 0 個以上の長さの文字の列 Java では String クラス 操作 文字列を作る 連結する 文字列中に文字列を探す 文字列中の文字列を置き換える 部分文字列を得る 3 String クラス 文字列を保持するクラス 文字列は定数であることに注意 比較に注意 == : オブジェクトとしての同等性

More information

Microsoft Word - NonGenList.doc

Microsoft Word - NonGenList.doc ジェネリクスとコンパレータを使用しないリストのプログラム例 1. ポインタによる線形リスト LinkedListNG.java: ポインタによる線形リストのクラス LinkedListNG LinkedListTesterNG.java: LinkedListNG を利用するプログラム例 2. カーソルによる線形リスト AryLinkedListNG.java: カーソルによる線形リストのクラス AryLinkedListNG

More information

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a 55 7 Java C Java TCP/IP TCP/IP 7.1 7.1.1 TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1]));

More information

目 次 オブジェクト指向 1 3 オブジェクト指向 2 9 二分探索 14 二次元配列 16 ソート 18 ArrayList 25 解答 27 2

目 次 オブジェクト指向 1 3 オブジェクト指向 2 9 二分探索 14 二次元配列 16 ソート 18 ArrayList 25 解答 27 2 全国商業高等学校協会主催 情報処理検定 ( プログラミング部門 ) Java 1 級 問題集 1 目 次 オブジェクト指向 1 3 オブジェクト指向 2 9 二分探索 14 二次元配列 16 ソート 18 ArrayList 25 解答 27 2 問 1. プログラムの説明を読んで プログラムの ( public class Bunkatsu1_1 { コンストラクタを用いて表示す

More information