Similar documents
K227 Java 2

8 if switch for while do while 2

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

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

)+, $( -++ $ )* "& $ "$...( # / $ & ' / $# && &# & ' '' '( '# ' "& / $ $

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

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

r1.dvi

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

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

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

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

r02.dvi

ohp02.dvi

: : : TSTank 2


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

新・明解Java入門

Java updated

Microsoft Word - keisankigairon.ch doc

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

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

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac


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

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演習(4) -- 変数と型 --

untitled

解きながら学ぶJava入門編

ALG ppt

(Eclipse\202\305\212w\202\324Java2\215\374.pdf)

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

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

Java学習教材

I java A

untitled

JavaプログラミングⅠ

ALG2012-F.ppt

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

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

2

JavaプログラミングⅠ


oop1

untitled

文字列操作と正規表現

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

Java講座

#"

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


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

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

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

コーディング基準.PDF

JavaプログラミングⅠ

2

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

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

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

Microsoft PowerPoint ppt

橡統計担当者のためのエクセル表紙.PDF

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

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

プログラミング入門1

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

ex01.dvi

PowerPoint プレゼンテーション

ex01.dvi

(Basic Theory of Information Processing) 1

目 次 Java GUI 3 1 概要 クラス構成 ソースコード例 課題...7 i

ALG2012-A.ppt

226

1.ppt

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

ohp07.dvi

JAVA とテンプレート

グラフと組み合わせ 課題 7 ( 解答例 ) 2013/5/27 1 列挙 n 個の文字の集合 { } S = a, a,, an の全てからなる文字列 つまり同じ文字を含まない 長さ n の文字列を列挙する 方法を考える 1. 何通りの文字列があるかを答えなさい また そのことが正しい

2 static final int DO NOTHING ON CLOSE static final int HIDE ON CLOSE static final int DISPOSE ON CLOSE static final int EXIT ON CLOSE void setvisible


ただし 無作為にスレッドを複数実行すると 結果不正やデッドロックが起きる可能性がある 複数のスレッド ( マルチスレッド ) を安全に実行する ( スレッドセーフにする ) ためには 同期処理を用いるこ とが必要になる 同期処理は 予約語 synchronized で行うことができる ここでは sy

Microsoft Word - =?iso-2022-jp?B?SFAbJEJNUSEhIUpMPkEwRn4kaiFLGyhCNDAbJEJCZUZ8S1wbKEI=?= =?iso-2022-jp?B?GyRCP00kTkNmOXE0USFKI1cjUCFLRHM9UE1RGyhCKBskQj0kGyhCLg==?= =?iso-2022-jp?B?ZG9j?=

6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent thread, 1 GUI 6.0.2, mutlithread C

プログラミングA

改訂版 :基本的な文字化の原則(Basic Transcription System for Japanese: BTSJ)

Prog2_9th

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

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

tkk0408nari

10K pdf

JavaプログラミングⅠ

Thread

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

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..

★分冊3-説明資料PDF用/02-PDF個別

™ƒŒì„³001†`028.pwd

†ı25”Y„o-PDF.ren

76

' % % &! #


Transcription:

CreW Project http://www.crew.sfc.keio.ac.jp/ 2003 5 8

I 5 1 7 1.1...................... 7 1.2..................... 10 1.2.1..................... 13 1.2.2..................... 15 1.2.3.......................... 17 1.2.4................... 19 1.3....................... 22 1.3.1........................... 22 1.3.2 HCP............... 22 1.3.3 HCP........... 23 1.4................... 24 1.4.1................... 24 1.4.2............................... 26 1.4.3.......................... 29 1.5.................................. 32 2 (1) 33 2.1.................................. 33 2.1.1......................... 33 2.1.2............................... 37 2.1.3................... 39 2.2.................................. 41 2.2.1................................ 41 2.2.2............................ 41 2.3.................................. 45 2.3.1............................... 45 2.3.2............................... 45

2.4.......................... 48 2.4.1................................. 48 2.5.................................. 51

1 ² ² ² " "

2 0 IT Java 5 10 Java?? " " ² ² ²

3 2 HCP

I

7 1 ² { { { ² HCP ² { { 1.1 ( 1 2) 1: 1: public class AddTwoNumberSample f 2: 3: public static void main(string[] args) f 4: int a, b, c; 5: a = Input.getInt(); 6: b = Input.getInt(); 7: c = a + b; 8: System.out.println(c); 9: g 10: 11: g

8 1 2: 1: /** 2: * 3: * 4: * 5: * 6: * 7: * @author Manabu Sugiura 8: * @version $Id: AddTwoNumberApplication.java,v 1.9 2003/05/20 12:24:47 duskin Exp $ 9: */ 10: public class AddTwoNumberApplication f 11: 12: public static void main(string[] args) f 13: AddTwoNumberApplication addtwonumberapplication = 14: new AddTwoNumberApplication(); 15: addtwonumberapplication.main(); 16: g 17: 18: void main() f 19: 20: int firstnumber; // 21: int secondnumber; // 22: int result; // 23: 24: // 25: System.out.println(" "); 26: System.out.println(" 2 0 "); 27: 28: // 29: System.out.print(" >>"); 30: System.out.flush(); 31: firstnumber = Input.getInt(); 32: 33: // 34: System.out.print(" >>"); 35: System.out.flush(); 36: secondnumber = Input.getInt(); 37: 38: // 39: while (firstnumber!= 0 secondnumber!= 0) f // 40: 41: // 42: result = firstnumber + secondnumber; 43: 44: // 45: System.out.println(" " + result + " "); 46: 47: // 48: System.out.print(" >>"); 49: System.out.flush(); 50: firstnumber = Input.getInt(); 51: 52: // 53: System.out.print(" >>");

1.1 9 54: System.out.flush(); 55: secondnumber = Input.getInt(); 56: g 57: 58: // 59: System.out.println(" "); 60: g 61: g ²

10 1 1.2 No 3: 1: public class Example f 2: 3: public static void main(string[] args) f 4: Example example = new Example(); 5: example.main(); 6: g 7: 8: void main()f 9: int a = 49; 10: int b = 73; 11: int c = 100; 12: int d = 45; 13: int e = 25; 14: double x = a + b + c + d + e; 15: double y = x / 5.0; 16: y = y * 10; 17: if((y % 10) >= 5)f 18: y = y + 10; 19: g 20: int z = (int)(y / 10); 21: System.out.println(z); 22: 23: g

1.2 11 Java " " package, import Java fg public class [ ]f g ( ) Java.java Sample.java public static void main(string args[]) 4 2 public static void main(string[] args)f [ ] [ ] = new [ ](); [ ].main(); g

12 1 void main() 2 main() 1 ( ) void main()f g ( ) 1 public static void main(string[] args) public static void main(string[] args) main() 4

1.2 13 1.2.1 4 4: 1: public class Example f 2: 3: public static void main(string[] args) f 4: Example example = new Example(); 5: example.main(); 6: g 7: 8: void main() f 9: 10: int a = 49; 11: int b = 73; 12: int c = 100; 13: int d = 45; 14: int e = 25; 15: 16: double x = a + b + c + d + e; 17: double y = x / 5.0; 18: 19: y = y * 10; 20: if ((y % 10) >= 5) f 21: y = y + 10; 22: g 23: int z = (int) (y / 10); 24: 25: System.out.println(z); 26: g 27: g ( 1.1) Java fg Java ( 1.2) TAB TAB 1 2

/ % % 14 1!#"%$ &'( )$*)+,.- / 1.1:! "$# 1.2: ( 1.3)! "$#%!& ' (*)+),-$#.!/10 /32 4#.!& 5 ' 687:9;)<' 687=/>),?#.!/@ A CB=7D EF G7HJILKM' 6N7% 6 )+9H/< 1.3:

1.2 15 1.2.2 Java a bbb 5: 1: public class ScoreAdministratorSample f 2: 3: public static void main(string[] args) f 4: ScoreAdministratorSample scoreadministratorsample = 5: new ScoreAdministratorSample(); 6: scoreadministratorsample.main(); 7: g 8: 9: void main() f 10: 11: int japanese = 49; 12: int mathematics = 73; 13: int science = 100; 14: int civics = 45; 15: int english = 25; 16: 17: double total = japanese + mathematics + science + civics + english; 18: double average = total / 5.0; 19: 20: average = average * 10; 21: if ((average % 10) >= 5) f 22: average = average + 10; 23: g 24: int result = (int) (average / 10); 25: 26: System.out.println(result); 27: g 28: g 1.2.2.1 Java Java 2 2

16 1 ² { { TicketReserveApplication TicketReserveApplication.java ² { { getcurrenttime ² { { familyname

1.2 17 1.2.3 6 6: 1: public class ScoreAdministratorSample f 2: 3: public static void main(string[] args) f 4: ScoreAdministratorSample scoreadministratorsample = 5: new ScoreAdministratorSample(); 6: scoreadministratorsample.main(); 7: g 8: 9: void main() f 10: // 11: int japanese = 49; // japanese 12: int mathematics = 73; // mathematics 13: int science = 100; // science 14: int civics = 45; // civics 15: int english = 25; // english 16: 17: // total 5 average 18: double total = japanese + mathematics + science + civics + english; 19: double average = total / 5.0; 20: 21: //average 10 10 22: average = average * 10; 23: if ((average % 10) >= 5) f // 5 24: average = average + 10; //10 25: g 26: // result 27: int result = (int) (average / 10); 28: 29: // result 30: System.out.println(result); 31: g 32: g

18 1 1.2.3.1 Java /* */ /* */ Java Javadoc /** * /** * Java */ // int x;// ( 6) ²

1.2 19 1.2.4 1.2.4.1 6 //average 10 10 average = average * 10; if ((average % 10) >= 5) f // 5 average = average + 10; //10 g ² // average = average * 10; if ((average % 10) >= 5) f // average = average + 10; // g int result = (int) (average / 10); 7 7: 1: /** 2: * 3: * 4: * 5: * 6: * @author Manabu Sugiura 7: * @version $Id: ScoreAdministratorSample.java,v 1.11 2003/08/08 13:15:50 duskin Exp $ 8: */ 9: public class ScoreAdministratorSample f 10: 11: public static void main(string[] args) f

20 1 12: ScoreAdministratorSample scoreadministratorsample = 13: new ScoreAdministratorSample(); 14: scoreadministratorsample.main(); 15: g 16: 17: void main() f 18: 19: // 20: int japanese = 49; // 21: int mathematics = 73; // 22: int science = 100; // 23: int civics = 45; // 24: int english = 25; // 25: 26: // 27: double total = japanese + mathematics + science + civics + english; 28: // 29: double average = total / 5.0; // 30: 31: // 32: average = average * 10; 33: if ((average % 10) >= 5) f // 34: average = average + 10; // 35: g 36: int result = (int) (average / 10); 37: 38: // 39: System.out.println(result); 40: g 41: g 1.2.4.2 3 ² ( )

W 1.2 21 ² ( 1.4) "!#%$ '& ( *),+-/. +021 3 (4),( 3%1 & 3 -)53%1 671 3 (8), &9:;1 (. < = > @?@ACBD 486 EF 9'4 *,G H I < 7 JAKML N @OJP Q RSL 867 EF 9'*,86 EF 9'4TVU I < 1 XZY[YF6 EF 9'4\VU I]"^ G8]`_` a Dbdc efgmh 86: EF 9'4i86 Ej 9'*)VU I < %kmlzf nj o 1 &8pE[ ( % qiy1 &r ] Yj86 Ej 9' U I'] < sojp QMR tvus Dw xld y:z (r + H 'r H $'Eq1 &r{ &Y[EF ('% ] < 1.4: ²

22 1 1.3 1.3.1 ² { { { { 1.3.2 HCP NTT HCP (Hierarchical and Compact Description Chart ) HCP HCP 1.5 HCP

1.3 23! " # $"# % & ''"# $'& ($ )*+,-/.10243 5768 9 2;: '<=$ 1.5: HCP 1.3.3 HCP HCP ( 1.5) ( 7) HCP HCP

24 1 1.4 1.4.1 " " 1.6: 1.6 GUI CUI {Application HCP 1.7 8!#" $%'& () * +,.- + ()!#"/1032,.456. 7'8:9 1.7: HCP

1.4 25 8: 1: /** 2: * 3: * 4: * @author Manabu Sugiura 5: * @version $Id: GreetingApplication.java,v 1.3 2003/05/04 16:25:14 macchan Exp $ 6: */ 7: public class GreetingApplication f 8: 9: public static void main(string[] args) f 10: GreetingApplication greetingapplication = new GreetingApplication(); 11: greetingapplication.main(); 12: g 13: 14: void main() f 15: 16: String name; // 17: 18: // 19: System.out.println(" "); 20: 21: // 22: System.out.println(" "); 23: System.out.print(">>"); 24: System.out.flush(); 25: name = Input.getString(); 26: 27: // 28: System.out.println(" " + name + " "); 29: System.out.println(" "); 30: 31: // 32: System.out.println(" "); 33: g 34: g 2

26 1 1.4.2 9 "!#%$'&)( * +, 2 "-.$/0 + 1 ' 2 1 3 1 +, 1 4 2 76 5 "!#%$98 :<; = >.?@ 'ACBED 1.8: HCP

1.4 27 9: 1: /** 2: * 3: * 4: * 5: * 6: * @author Manabu Sugiura 7: * @version $Id: GreetingApplication.java,v 1.5 2003/05/04 20:30:23 gackt Exp $ 8: */ 9: public class GreetingApplication f 10: 11: public static void main(string[] args) f 12: GreetingApplication greetingapplication = new GreetingApplication(); 13: greetingapplication.main(); 14: g 15: 16: void main() f 17: 18: String name; // 19: 20: // 21: System.out.println(" "); 22: 23: // 24: System.out.println(" "); 25: System.out.print(">>"); 26: System.out.flush(); 27: name = Input.getString(); 28: 29: // 30: while (name.length()!= 0) f 31: 32: // 33: System.out.println(" " + name + " "); 34: System.out.println(" "); 35: 36: // 37: System.out.println(" "); 38: System.out.print(">>"); 39: System.out.flush(); 40: name = Input.getString(); 41: g 42: 43: // 44: System.out.println(" "); 45: g 46: g

28 1 1.4.2.1 while while while while ( [ ] ) f g ( ) 1.9 HCP 1.10 F8G CED CED >@?BA >E?BA "!$# % &')(*+,-/. * 021436587:9<;<10= F8G HJI HJI 1.9: while

1.4 29 1.10: HCP 1.4.3 ( 10) 0 ² 2 0 ² 0 0

C C D D 30 1 "!$#"%'& (*) +,' " -$. / bdcfe 6cfe A g Y A g Y UWVYX %Z < @B3 U[VYX %Z G'\ 0$13246587:9;/<=.>?<A@3B3 24?5E-17F9HGAI.J3K L M %"NPORQ"%"S /T " 0$] /^3_`aT :"!$#'%"&:(h) 1 U[V 6ij`k6 /l\nm3 1.11: HCP 10: 1: /** 2: * 3: * 4: * 5: * 6: * ( ) 7: * 8: * @author Manabu Sugiura 9: * @version $Id: DivideTwoNumberApplication.java,v 1.10 2003/05/04 20:29:51 gackt Exp $ 10: */ 11: public class DivideTwoNumberApplication f 12: 13: public static void main(string[] args) f 14: DivideTwoNumberApplication dividetwonumberapplication = 15: new DivideTwoNumberApplication(); 16: dividetwonumberapplication.main(); 17: g 18: 19: void main() f

1.4 31 20: 21: int firstnumber; // 22: int secondnumber; // 23: int result; // 24: 25: // 26: System.out.println(" "); 27: System.out.println(" "); 28: 29: // 30: System.out.println(" "); 31: System.out.print(">>"); 32: System.out.flush(); 33: firstnumber = Input.getInt(); 34: 35: // 36: System.out.println(" "); 37: System.out.print(">>"); 38: System.out.flush(); 39: secondnumber = Input.getInt(); 40: 41: // 42: while (firstnumber!= 0 secondnumber!= 0) f 43: 44: // 45: if (secondnumber == 0) f // 46: System.out.println("!"); 47: break; // 48: g 49: 50: // 51: result = firstnumber / secondnumber; 52: System.out.println(" " + result + " "); 53: 54: // 55: System.out.println(" "); 56: System.out.print(">>"); 57: System.out.flush(); 58: firstnumber = Input.getInt(); 59: 60: // 61: System.out.println(" "); 62: System.out.print(">>"); 63: System.out.flush(); 64: secondnumber = Input.getInt(); 65: g 66: 67: // 68: System.out.println(" "); 69: g 70: g

32 1 1.5 1 2 2 HealthCareSample.java 3 AddTwoNumberApplication.java

33 2 (1) ² ² ² ² 2.1 2.1.1 HCP ( 2.1) 1,2,3 2.2

H I 34 2 (1) "! #"$&% ')( +*-, " "]_^a` $ 021 b +./021 3 4./021 3 6 7 8+9: ;< 5 =" "]c^ `$ b >@?A $6B)C3D 3E7FG >J?7A $ BLK&M N O2P Q K <&RTSU:/ 4 "! #"$&% ')( O >J?V WX Y 3Z M\[ 2.1: HCP! " # $&%(' 2.2:

v w + 2.1 35 1 2 1,2,3 HCP 2.3 11 132547684:98;< Q8RDS3TDUWV8XZY I\[^] 98;< RDŠŒ Ž 7U Ia_a` 9bLONP;D< E\FHGJI_a` 9bLONP;< c FHGJI_a` 9bLONP;< KAI L^NP9fe\gOh8ij => d I BC9J;< RDŠ 5 U IWK 9:LONP;D<,-/. 0! " $#%!&(') *! " $#%!&(' EFHGJIK 9MLONP;< kmlpn U7oqpbr <bspt7u< kmlfn U7o%xWy z x c KAIaK7{a 7} jd~ h ;< FHGJIK 9MLONP;< =7> 9:?A@;< =7> 9:BCD;< Q8RDS3TDUWV8XZY { k/lf 3ƒ 5 9b y ˆ < 2.3: HCP

36 2 (1) 11: 1: /** 2: * 3: * 4: * 5: * 6: * 7: * @author macchan 8: * @version $Id: JankenApplication.java,v 1.11 2003/05/04 20:54:13 gackt Exp $ 9: */ 10: public class JankenApplication f 11: 12: public static void main(string[] args) f 13: JankenApplication jankenapplication = new JankenApplication(); 14: jankenapplication.main(); 15: g 16: 17: void main() f 18: 19: String playernamea; // A 20: String playernameb; // B 21: int playerhanda; // A 22: int playerhandb; // B 23: int i; // 24: 25: // 26: System.out.println(" "); 27: System.out.println(" A "); 28: 29: // A 30: System.out.println(" A "); 31: System.out.print(">>"); 32: System.out.flush(); 33: playernamea = Input.getString(); 34: 35: // B 36: System.out.println(" B "); 37: System.out.print(">>"); 38: System.out.flush(); 39: playernameb = Input.getString(); 40: 41: // 42: while (true) f 43: 44: // A 45: System.out.println(playerNameA + " "); 46: System.out.println("1., 2., 3. (0. )"); 47: System.out.print(">>"); 48: System.out.flush(); 49: playerhanda = Input.getInt(); 50: 51: // 52: if (playerhanda == 0) f // 53: break; //

2.1 37 54: g 55: 56: // 57: i = 0; 58: while (i < 100) f 59: System.out.println(); 60: i = i + 1; 61: g 62: 63: // B 64: System.out.println(playerNameB + " "); 65: System.out.println("1., 2., 3. "); 66: System.out.print(">>"); 67: System.out.flush(); 68: playerhandb = Input.getInt(); 69: 70: // 71: if (playerhanda == 1 && playerhandb == 2) f // VS 72: System.out.println(playerNameA + " "); 73: g else if (playerhanda == 1 && playerhandb == 3) f // VS 74: System.out.println(playerNameB + " "); 75: g else if (playerhanda == 2 && playerhandb == 1) f // VS 76: System.out.println(playerNameB + " "); 77: g else if (playerhanda == 2 && playerhandb == 3) f // VS 78: System.out.println(playerNameA + " "); 79: g else if (playerhanda == 3 && playerhandb == 1) f // VS 80: System.out.println(playerNameA + " "); 81: g else if (playerhanda == 3 && playerhandb == 2) f // VS 82: System.out.println(playerNameB + " "); 83: g else if (playerhanda == playerhandb) f // 84: System.out.println(" "); 85: g else f // 86: System.out.println(" "); 87: g 88: g 89: 90: // 91: System.out.println(" "); 92: g 93: g 2.1.2 11 playerhanda playerhandb 1,2,3 0.05 " " ( 1) ( playerhand)

" ' ) ( 38 2 (1) 2.4 1 #$&%!! * +-,/.1032541687 2.4: 1 HCP ( 2.3) HCP HCP

V & ' V 2.1 39 2.1.3 2.1.3.1 2.5 8>9?; = %'& ( )+*,.-/(10"*32 "!$# 8:9<; = %1& (4)+*,5-6(10"*2 %1& (4)+*,5-6(10"*'7 2.5: 2.1.3.2 = = 2.6 QSRWT ;B< =>@?BADCE=GFH?J ;B< =>@?BADCE=GFH?I "!$# % (*),+,-/. +103254168789,: QSRUT ;< =>@?BADCE=GFH?J K@LNMPO ;< =>@?BADCE=GFH?I 2.6:

& & Y @ & & & & & & & B J J J J & J & & Q @ A @ D 40 2 (1) 2.1.3.3 2.7 1'2D3E5 FGH %IJGFKL MDNPO "! #%$'&(*)+#",-&0 "! #%$'&(*)+#",-&/.! #9$'&:(<;+#>=9?0! #9$'&:(<;+#>=9?/. 1"78265 1'24365 C/C 2.7: 2.1.3.4 2.8 ')(+*,.-)/1032 547698;: /<032 $ % $ "#! "$#% "#! "$# $ > $ = $! "?#% @ $! "?# ;547698;: /<032 $ E G $ E G "#% G "# < ;< L?L $ < >< $ A 7 ;<! G < B E =< K $ C "$# K!B F ;< C E $ C "?# Ḧ 7 A E ; $!B "?# G A E $ ḦIF "?# < ;!B F ; $!B "$# A C "?# ; ḦI "?# $ B "# ;< K "# $ Ḧ "?#!B "$# "?#G A "?# B "# $ "?# $ B "# & 8 DMNOL?LPQSR=TVU;WX L L 2.8:

4 2.2 41 2.2 2.2.1 i + 1 2.9 5&687 9 " # )*$('! #$&%(' +,.-/0213" +,.-/021+! =?> @ 5&687 9 : ;+ 3" #)*$(' : ;+ +! #<$&%(' +,;-/ 021 " +,;-/ 021! 4A B 2.9: 2.2.2 2.2.2.1 if if if ( [ ] ) f // (true) g else f g // (false) if else else

42 2 (1) 2.10: if 2.10 3 if else if ( [ 1] ) f // 1 (true) g else if( [ 2] )f g else f g // 2 (true) // 1 2 (false) HCP 2.11 2.11: if HCP

2.2 43 2.2.2.2 ² Java (boolean) true false while if true false ² 2.1: Java A,B == A==B A B true!= A!=B A B true > A>B A B true < A<B A B true >= A>=B A B true <= A<=B A B true 2.2: Java A,B && A&&B A B true true jj AjjB A B true true

Q O P 44 2 (1) 2.2.2.3 if if(playerhanda==1 playerhandb==2) 2.12! #" $%&(' 121 *,+.-0/ ' ) 5-6+87 '(%:9 +3; '>= 5-6+87 '(%:9 +3; ' < 5 -J+7 '(%LK +.M(N = 5 -J+7 '(%LK +.M(N <?GFH@ID?A@CBED RSR *,+3-4/ ' 2.12:

2.3 45 2.3 2.3.1 2.1.3.1 Java (int) -1, 0, 1, 2, 3 (String) " ", " " ( 2.13) -/.10 2! " # $% '&! + )* # $% '&( )* #*, 3 46587 395/:87 3!;/<+7 -/.10 2! " # $% '&! + )* # $% '&( )* #*, = >? 2.13: Java 8 2 String Java String 2.3.2 ( 12) 2 Java ( ) H

d 46 2 (1) egfh)i %jgkolutwvx g =!#"$&% ')(*,+-./ 0!2"$3% '546 1 7 8 9 78 :<; 9 78 egfh)i %jgkolm!#" onp q 6sr `acb BEDZHIARFRy=z{J?D}HW~YET S?T@QC>ULONV?BCQ >@? ACBEDGFIHKJMLONP? BRQ J\YETU]^HIB@_ FI>IQR>RLONV? BCQ >U? ARBWDGFCHKJMXZYWJ[Q U U 2.14: HCP 12: 1: public class PriceTagApplication f 2: 3: public static void main(string[] args) f 4: PriceTagApplication pricetagapplication = new PriceTagApplication(); 5: pricetagapplication.main(); 6: g 7: 8: void main() f 9: 10: double consumptiontax = 0.05; // 11: int fixedprice; // 12: int discountprice; // 13: int taxincludedprice; // 14: int discountrate; // 15: 16: // 17: System.out.println(" "); 18: System.out.println(" "); 19:

2.3 47 20: // 21: while (true) f 22: 23: // 24: System.out.println(" "); 25: System.out.print(">>"); 26: System.out.flush(); 27: fixedprice = Input.getInt(); 28: 29: // 30: if (fixedprice == 0) f // 31: System.out.println(" "); 32: break; // 33: g 34: 35: // 36: System.out.println(" "); 37: System.out.print(">>"); 38: System.out.flush(); 39: discountrate = Input.getInt(); 40: 41: // 42: discountprice = 43: (int) (fixedprice * (1 - (double) discountrate / 100)); 44: 45: // 46: taxincludedprice = (int) (discountprice * (1 + consumptiontax)); 47: 48: // 49: System.out.println("--------------------"); 50: System.out.println(" :" + fixedprice + " "); 51: System.out.println("--------------------"); 52: System.out.println( 53: " :" + discountprice + " " + discountrate + "%OFF "); 54: System.out.println("--------------------"); 55: System.out.println(" " + taxincludedprice + " "); 56: System.out.println("--------------------"); 57: g 58: 59: // 60: System.out.println(" "); 61: g 62: g Java Tips ² () ² break while break

48 2 (1) 2.4 2.4.1 11 1,2,3 1,2,3 2.15 /.1023 3!#"$&%('*) +-,!4"/$&%'*) 576 6!#"/$&%'8) 2.15: 13 13: ( ) 1: /** 2: * 3: * 4: * 5: * 6: * 7: * 8: * @author macchan 9: * @version $Id: JankenApplication.java,v 1.5 2003/05/04 20:54:13 gackt Exp $ 10: */ 11: public class JankenApplication f 12: 13: public static void main(string[] args) f 14: JankenApplication jankenapplication = new JankenApplication(); 15: jankenapplication.main(); 16: g 17: 18: void main() f 19: 20: final int GOO = 1; // 21: final int CHOKI = 2; // 22: final int PAA = 3; //

2.4 49 23: 24: String playernamea; // A 25: String playernameb; // B 26: int playerhanda; // A 27: int playerhandb; // B 28: int i; // 29: 30: // 31: System.out.println(" "); 32: System.out.println(" A "); 33: 34: // A 35: System.out.println(" A "); 36: System.out.print(">>"); 37: System.out.flush(); 38: playernamea = Input.getString(); 39: 40: // B 41: System.out.println(" B "); 42: System.out.print(">>"); 43: System.out.flush(); 44: playernameb = Input.getString(); 45: 46: // 47: while (true) f 48: 49: // A 50: System.out.println(playerNameA + " "); 51: System.out.println("1., 2., 3. (0. )"); 52: System.out.print(">>"); 53: System.out.flush(); 54: playerhanda = Input.getInt(); 55: 56: // 57: if (playerhanda == 0) f // 58: break; // 59: g 60: 61: // 62: i = 0; 63: while (i < 100) f 64: System.out.println(); 65: i = i + 1; 66: g 67: 68: // B 69: System.out.println(playerNameB + " "); 70: System.out.println("1., 2., 3. "); 71: System.out.print(">>"); 72: System.out.flush(); 73: playerhandb = Input.getInt(); 74: 75: // 76: if (playerhanda == GOO && playerhandb == CHOKI) f // VS

50 2 (1) 77: System.out.println(playerNameA + " "); 78: g else if (playerhanda == GOO && playerhandb == PAA) f // VS 79: System.out.println(playerNameB + " "); 80: g else if (playerhanda == CHOKI && playerhandb == GOO) f // VS 81: System.out.println(playerNameB + " "); 82: g else if (playerhanda == CHOKI && playerhandb == PAA) f // VS 83: System.out.println(playerNameA + " "); 84: g else if (playerhanda == PAA && playerhandb == GOO) f // VS 85: System.out.println(playerNameA + " "); 86: g else if (playerhanda == PAA && playerhandb == CHOKI) f // VS 87: System.out.println(playerNameB + " "); 88: g else if (playerhanda == playerhandb) f // 89: System.out.println(" "); 90: g else f // 91: System.out.println(" "); 92: g 93: g 94: 95: // 96: System.out.println(" "); 97: g 98: g 3 final [ ] [ ] = [ ]; 3

2.5 51 2.5 1 2 14 14: 2 /** * * * @author Manabu Sugiura * @version $Id: AddTwoNumbersSample.java,v 1.4 2003/05/04 17:16:47 macchan Exp $ */ public class AddTwoNumbersSample f public static void main(string args[]) f AddTwoNumbersSample addtwonumberssample = new AddTwoNumbersSample(); addtwonumberssample.main(); g void main() f g g int numbera; // int numberb; // // numbera = 3; numberb = 5; // System.out.println( numbera + " " + numberb + " " + numbera + numberb + " ");

52 2 (1) 3* 1. g 1 2. 3. 4. 5. ² g