diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Marriage.java b/java-learning/src/jp/co/jid/exBasic/Marriage.java deleted file mode 100644 index cb0104d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Marriage.java +++ /dev/null @@ -1,31 +0,0 @@ -package jp.co.jid.exBasic; - -public class Marriage { - /** 結婚可能年齢:男 */ - private static final int MAN_MARRIAGABLE_AGE = 18; - /** 結婚可能年齢:女 */ - private static final int WOMAN_MARRIAGABLE_AGE = 16; - - public boolean checkMarriage(Human human) { - if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) { - return true; - } else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) { - return true; - } else { - return false; - } - } - - public boolean checkMarriage(Human human1, Human human2) { - if (human1.getSex().getSex() != human2.getSex().getSex()) { - return false; - } - if (!checkMarriage(human1)) { - return false; - } - if (!checkMarriage(human2)) { - return false; - } - return true; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Marriage.java b/java-learning/src/jp/co/jid/exBasic/Marriage.java deleted file mode 100644 index cb0104d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Marriage.java +++ /dev/null @@ -1,31 +0,0 @@ -package jp.co.jid.exBasic; - -public class Marriage { - /** 結婚可能年齢:男 */ - private static final int MAN_MARRIAGABLE_AGE = 18; - /** 結婚可能年齢:女 */ - private static final int WOMAN_MARRIAGABLE_AGE = 16; - - public boolean checkMarriage(Human human) { - if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) { - return true; - } else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) { - return true; - } else { - return false; - } - } - - public boolean checkMarriage(Human human1, Human human2) { - if (human1.getSex().getSex() != human2.getSex().getSex()) { - return false; - } - if (!checkMarriage(human1)) { - return false; - } - if (!checkMarriage(human2)) { - return false; - } - return true; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyList.java b/java-learning/src/jp/co/jid/exBasic/MyList.java deleted file mode 100644 index 98b4e4e..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyList.java +++ /dev/null @@ -1,43 +0,0 @@ -package jp.co.jid.exBasic; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -public class MyList { - private static final int RANDOM_NUMBER = 101; - - public List getRondomNumberList(int count) { - ArrayList list = new ArrayList(); - for (int i = 0; i < count; i++) { - list.add(Integer.valueOf((int)(Math.random() * 101))); - } - return list; - } - - public List getRondomNumberDuplicationList(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - while (list.size() < count) { - Integer integer = Integer.valueOf((int)(Math.random() * RANDOM_NUMBER)); - if (!list.contains(integer)) { - list.add(integer); - } - } - return list; - } - - public List getRondomNumberDuplicationList2(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - HashSet set = new HashSet(); - while (set.size() < count) { - set.add(Integer.valueOf((int)(Math.random() * RANDOM_NUMBER))); - } - return list; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Marriage.java b/java-learning/src/jp/co/jid/exBasic/Marriage.java deleted file mode 100644 index cb0104d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Marriage.java +++ /dev/null @@ -1,31 +0,0 @@ -package jp.co.jid.exBasic; - -public class Marriage { - /** 結婚可能年齢:男 */ - private static final int MAN_MARRIAGABLE_AGE = 18; - /** 結婚可能年齢:女 */ - private static final int WOMAN_MARRIAGABLE_AGE = 16; - - public boolean checkMarriage(Human human) { - if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) { - return true; - } else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) { - return true; - } else { - return false; - } - } - - public boolean checkMarriage(Human human1, Human human2) { - if (human1.getSex().getSex() != human2.getSex().getSex()) { - return false; - } - if (!checkMarriage(human1)) { - return false; - } - if (!checkMarriage(human2)) { - return false; - } - return true; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyList.java b/java-learning/src/jp/co/jid/exBasic/MyList.java deleted file mode 100644 index 98b4e4e..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyList.java +++ /dev/null @@ -1,43 +0,0 @@ -package jp.co.jid.exBasic; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -public class MyList { - private static final int RANDOM_NUMBER = 101; - - public List getRondomNumberList(int count) { - ArrayList list = new ArrayList(); - for (int i = 0; i < count; i++) { - list.add(Integer.valueOf((int)(Math.random() * 101))); - } - return list; - } - - public List getRondomNumberDuplicationList(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - while (list.size() < count) { - Integer integer = Integer.valueOf((int)(Math.random() * RANDOM_NUMBER)); - if (!list.contains(integer)) { - list.add(integer); - } - } - return list; - } - - public List getRondomNumberDuplicationList2(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - HashSet set = new HashSet(); - while (set.size() < count) { - set.add(Integer.valueOf((int)(Math.random() * RANDOM_NUMBER))); - } - return list; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyMath.java b/java-learning/src/jp/co/jid/exBasic/MyMath.java deleted file mode 100644 index 52a049d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyMath.java +++ /dev/null @@ -1,231 +0,0 @@ -package jp.co.jid.exBasic; - -public class MyMath { - - /** - * 加算を行うメソッド - * @param num1 被加算数 - * @param num2 加算数 - * @return num1 + num2 を返す - */ - public int calcPlus(int num1, int num2) { - return num1 + num2; - } - - /** - * 減算を行うメソッド - * @param num1 被減算数 - * @param num2 減算数 - * @return num1 - num2 を返す - */ - public int calcMinus(int num1, int num2) { - return num1 - num2; - } - - /** - * 乗算を行うメソッド - * @param num1 被乗数 - * @param num2 乗数 - * @return num1 * num2 を返す - */ - public int calcTime(int num1, int num2) { - int result = 0; - for (int i = 0; i < num2; i++) { - result = calcPlus(result, num1); - } - return result; - } - - /** - * 除算(商を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @return num1 / num2 の商を返す - */ - public int calcDiv(int num1, int num2) { - return num1 / num2; - } - - /** - * 除算(余を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @retur num1 / num2 の余を返す - */ - public int calcMod(int num1, int num2) { - return calcMinus(num1, calcTime(calcDiv(num1, num2), num2)); - } - - /** - * 可変長変数の合計を求めるメソッド - * @param nums 可変長変数 - * @return 合計 - */ - public int calcSum(int... nums) { - int sum = 0; - for (int num : nums) { - sum += num; - } - return sum; - } - - /** - * 可変長変数の平均を求めるメソッド - * @param nums 可変長変数 - * @return 平均 - */ - public double calcAvg(int... nums) { - return (double)calcSum(nums) / nums.length; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum1(int fromNum, int toNum) { - int sum = 0; - for (int num = fromNum; num <= toNum; num++) { - sum += num; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum2(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - while (num <= toNum) { - sum += num++; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum3(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - do { - sum += num++; - } while (num <= toNum); - return sum; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数と第3引数の和 - * 2:第2引数と第3引数の差 - * 3:第2引数と第3引数の積 - * 4:第2引数と第3引数の商 - * 5:第2引数と第3引数の余 - * @param funcNum 度の処理を行うかの指定値 - * @param num1 - * @param num2 - * @return 計算結果 - */ - public int calc(int funcNum, int num1, int num2) { - switch (funcNum) { - case 1: - return calcPlus(num1, num2); - case 2: - return calcMinus(num1, num2); - case 3: - return calcTime(num1, num2); - case 4: - return calcDiv(num1, num2); - case 5: - return calcMod(num1, num2); - default: - return 0; - } - } - - /** - * 最大値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最大値 - */ - public int max(int... nums) { - int max = Integer.MIN_VALUE; - for (int num : nums) { - if (num > max) { - max = num; - } - } - return max; - } - - /** - * 最小値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最小値 - */ - public int min(int... nums) { - int min = Integer.MAX_VALUE; - for (int num : nums) { - if (num < min) { - min = num; - } - } - return min; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数以降の合計値 - * 2:第2引数以降の平均値(整数部のみ) - * 3:第2引数以降の最大値 - * 4:第2引数以降の最小値 - * ただし、引数が1つの場合は「0」を返す。 - * @param nums 対象の可変長変数 - * @return 処理結果 - */ - public int calc2(int... nums) { - if (nums.length == 1) { - return 0; - } - switch (nums[0]) { - case 1: - int sum1 = 0; - for (int i = 1; i < nums.length; i++) { - sum1 += nums[i]; - } - return sum1; - case 2: - int sum2 = 0; - for (int i = 1; i < nums.length; i++) { - sum2 += nums[i]; - } - return sum2 / (nums.length - 1); - case 3: - int max = Integer.MIN_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] > max) { - max = nums[i]; - } - } - return max; - case 4: - int min = Integer.MAX_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] < min) { - min = nums[i]; - } - } - return min; - default: - return 0; - } - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Marriage.java b/java-learning/src/jp/co/jid/exBasic/Marriage.java deleted file mode 100644 index cb0104d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Marriage.java +++ /dev/null @@ -1,31 +0,0 @@ -package jp.co.jid.exBasic; - -public class Marriage { - /** 結婚可能年齢:男 */ - private static final int MAN_MARRIAGABLE_AGE = 18; - /** 結婚可能年齢:女 */ - private static final int WOMAN_MARRIAGABLE_AGE = 16; - - public boolean checkMarriage(Human human) { - if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) { - return true; - } else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) { - return true; - } else { - return false; - } - } - - public boolean checkMarriage(Human human1, Human human2) { - if (human1.getSex().getSex() != human2.getSex().getSex()) { - return false; - } - if (!checkMarriage(human1)) { - return false; - } - if (!checkMarriage(human2)) { - return false; - } - return true; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyList.java b/java-learning/src/jp/co/jid/exBasic/MyList.java deleted file mode 100644 index 98b4e4e..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyList.java +++ /dev/null @@ -1,43 +0,0 @@ -package jp.co.jid.exBasic; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -public class MyList { - private static final int RANDOM_NUMBER = 101; - - public List getRondomNumberList(int count) { - ArrayList list = new ArrayList(); - for (int i = 0; i < count; i++) { - list.add(Integer.valueOf((int)(Math.random() * 101))); - } - return list; - } - - public List getRondomNumberDuplicationList(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - while (list.size() < count) { - Integer integer = Integer.valueOf((int)(Math.random() * RANDOM_NUMBER)); - if (!list.contains(integer)) { - list.add(integer); - } - } - return list; - } - - public List getRondomNumberDuplicationList2(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - HashSet set = new HashSet(); - while (set.size() < count) { - set.add(Integer.valueOf((int)(Math.random() * RANDOM_NUMBER))); - } - return list; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyMath.java b/java-learning/src/jp/co/jid/exBasic/MyMath.java deleted file mode 100644 index 52a049d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyMath.java +++ /dev/null @@ -1,231 +0,0 @@ -package jp.co.jid.exBasic; - -public class MyMath { - - /** - * 加算を行うメソッド - * @param num1 被加算数 - * @param num2 加算数 - * @return num1 + num2 を返す - */ - public int calcPlus(int num1, int num2) { - return num1 + num2; - } - - /** - * 減算を行うメソッド - * @param num1 被減算数 - * @param num2 減算数 - * @return num1 - num2 を返す - */ - public int calcMinus(int num1, int num2) { - return num1 - num2; - } - - /** - * 乗算を行うメソッド - * @param num1 被乗数 - * @param num2 乗数 - * @return num1 * num2 を返す - */ - public int calcTime(int num1, int num2) { - int result = 0; - for (int i = 0; i < num2; i++) { - result = calcPlus(result, num1); - } - return result; - } - - /** - * 除算(商を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @return num1 / num2 の商を返す - */ - public int calcDiv(int num1, int num2) { - return num1 / num2; - } - - /** - * 除算(余を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @retur num1 / num2 の余を返す - */ - public int calcMod(int num1, int num2) { - return calcMinus(num1, calcTime(calcDiv(num1, num2), num2)); - } - - /** - * 可変長変数の合計を求めるメソッド - * @param nums 可変長変数 - * @return 合計 - */ - public int calcSum(int... nums) { - int sum = 0; - for (int num : nums) { - sum += num; - } - return sum; - } - - /** - * 可変長変数の平均を求めるメソッド - * @param nums 可変長変数 - * @return 平均 - */ - public double calcAvg(int... nums) { - return (double)calcSum(nums) / nums.length; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum1(int fromNum, int toNum) { - int sum = 0; - for (int num = fromNum; num <= toNum; num++) { - sum += num; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum2(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - while (num <= toNum) { - sum += num++; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum3(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - do { - sum += num++; - } while (num <= toNum); - return sum; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数と第3引数の和 - * 2:第2引数と第3引数の差 - * 3:第2引数と第3引数の積 - * 4:第2引数と第3引数の商 - * 5:第2引数と第3引数の余 - * @param funcNum 度の処理を行うかの指定値 - * @param num1 - * @param num2 - * @return 計算結果 - */ - public int calc(int funcNum, int num1, int num2) { - switch (funcNum) { - case 1: - return calcPlus(num1, num2); - case 2: - return calcMinus(num1, num2); - case 3: - return calcTime(num1, num2); - case 4: - return calcDiv(num1, num2); - case 5: - return calcMod(num1, num2); - default: - return 0; - } - } - - /** - * 最大値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最大値 - */ - public int max(int... nums) { - int max = Integer.MIN_VALUE; - for (int num : nums) { - if (num > max) { - max = num; - } - } - return max; - } - - /** - * 最小値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最小値 - */ - public int min(int... nums) { - int min = Integer.MAX_VALUE; - for (int num : nums) { - if (num < min) { - min = num; - } - } - return min; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数以降の合計値 - * 2:第2引数以降の平均値(整数部のみ) - * 3:第2引数以降の最大値 - * 4:第2引数以降の最小値 - * ただし、引数が1つの場合は「0」を返す。 - * @param nums 対象の可変長変数 - * @return 処理結果 - */ - public int calc2(int... nums) { - if (nums.length == 1) { - return 0; - } - switch (nums[0]) { - case 1: - int sum1 = 0; - for (int i = 1; i < nums.length; i++) { - sum1 += nums[i]; - } - return sum1; - case 2: - int sum2 = 0; - for (int i = 1; i < nums.length; i++) { - sum2 += nums[i]; - } - return sum2 / (nums.length - 1); - case 3: - int max = Integer.MIN_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] > max) { - max = nums[i]; - } - } - return max; - case 4: - int min = Integer.MAX_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] < min) { - min = nums[i]; - } - } - return min; - default: - return 0; - } - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyString.java b/java-learning/src/jp/co/jid/exBasic/MyString.java deleted file mode 100644 index 7535907..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyString.java +++ /dev/null @@ -1,44 +0,0 @@ -package jp.co.jid.exBasic; - -public class MyString { - - public void beep(int count) { - for (int i = 0; i < count; i++) { - System.out.println("ビーーー"); - } - } - - public void branch(int func) { - switch (func) { - case 1: - System.out.println("おはようございます"); - return; - case 2: - System.out.println("こんにちは"); - return; - case 3: - System.out.println("こんばんは"); - return; - case 4: - System.out.println("おやすみなさい"); - return; - case 5: - System.out.println("また明日"); - return; - default: - System.out.println("さようなら。。。"); - } - } - - public String concat(String[] strArray) { - StringBuffer sb = new StringBuffer(); - for (String str : strArray) { - sb.append(str); - } - return sb.toString(); - } - - public String replace(String csvString) { - return csvString.replace(",", "\t"); - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Blood.java b/java-learning/src/jp/co/jid/exBasic/Blood.java deleted file mode 100644 index 94a3da1..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Blood.java +++ /dev/null @@ -1,47 +0,0 @@ -package jp.co.jid.exBasic; - -public class Blood { - /** 血液型:A型 */ - public static final String BLOOD_TYPE_A = "A"; - /** 血液型:B型 */ - public static final String BLOOD_TYPE_B = "B"; - /** 血液型:AB型 */ - public static final String BLOOD_TYPE_AB = "AB"; - /** 血液型:O型 */ - public static final String BLOOD_TYPE_O = "O"; - - /** 血液型 */ - private String blood; - - /** - * 血液型がA型か? - * @return 血液型がA型ならtrueを返す - */ - public boolean isA() { - return this.blood.equals(BLOOD_TYPE_A) ? true : false; - } - - /** - * 血液型がB型か? - * @return 血液型がB型ならtrueを返す - */ - public boolean isB() { - return this.blood.equals(BLOOD_TYPE_B) ? true : false; - } - - /** - * 血液型がAB型か? - * @return 血液型がAB型ならtrueを返す - */ - public boolean isAB() { - return this.blood.equals(BLOOD_TYPE_AB) ? true : false; - } - - /** - * 血液型がO型か? - * @return 血液型がO型ならtrueを返す - */ - public boolean isO() { - return this.blood.equals(BLOOD_TYPE_O) ? true : false; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Human.java b/java-learning/src/jp/co/jid/exBasic/Human.java deleted file mode 100644 index 63b99e8..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Human.java +++ /dev/null @@ -1,81 +0,0 @@ -package jp.co.jid.exBasic; - -public class Human { - private int age; - private String name; - private Sex sex; - private Blood blood; - private double height; - private double weight; - - public Human(int age, String name, Sex sex, Blood blood, double height, double weight) { - this.age = age; - this.name = name; - this.sex = sex; - this.blood = blood; - this.height = height; - this.weight = weight; - } - - public void speak() { - System.out.println("・・・"); - } - - public void speak(String words) { - System.out.println(words); - } - - public void speak(String words, int count) { - for (int i = 0; i < count; i++) { - System.out.println(words); - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Sex getSex() { - return sex; - } - - public void setSex(Sex sex) { - this.sex = sex; - } - - public Blood getBlood() { - return blood; - } - - public void setBlood(Blood blood) { - this.blood = blood; - } - - public double getHeight() { - return height; - } - - public void setHeight(double height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Marriage.java b/java-learning/src/jp/co/jid/exBasic/Marriage.java deleted file mode 100644 index cb0104d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Marriage.java +++ /dev/null @@ -1,31 +0,0 @@ -package jp.co.jid.exBasic; - -public class Marriage { - /** 結婚可能年齢:男 */ - private static final int MAN_MARRIAGABLE_AGE = 18; - /** 結婚可能年齢:女 */ - private static final int WOMAN_MARRIAGABLE_AGE = 16; - - public boolean checkMarriage(Human human) { - if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) { - return true; - } else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) { - return true; - } else { - return false; - } - } - - public boolean checkMarriage(Human human1, Human human2) { - if (human1.getSex().getSex() != human2.getSex().getSex()) { - return false; - } - if (!checkMarriage(human1)) { - return false; - } - if (!checkMarriage(human2)) { - return false; - } - return true; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyList.java b/java-learning/src/jp/co/jid/exBasic/MyList.java deleted file mode 100644 index 98b4e4e..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyList.java +++ /dev/null @@ -1,43 +0,0 @@ -package jp.co.jid.exBasic; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -public class MyList { - private static final int RANDOM_NUMBER = 101; - - public List getRondomNumberList(int count) { - ArrayList list = new ArrayList(); - for (int i = 0; i < count; i++) { - list.add(Integer.valueOf((int)(Math.random() * 101))); - } - return list; - } - - public List getRondomNumberDuplicationList(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - while (list.size() < count) { - Integer integer = Integer.valueOf((int)(Math.random() * RANDOM_NUMBER)); - if (!list.contains(integer)) { - list.add(integer); - } - } - return list; - } - - public List getRondomNumberDuplicationList2(int count) { - if (count > RANDOM_NUMBER) { - return null; - } - ArrayList list = new ArrayList(); - HashSet set = new HashSet(); - while (set.size() < count) { - set.add(Integer.valueOf((int)(Math.random() * RANDOM_NUMBER))); - } - return list; - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyMath.java b/java-learning/src/jp/co/jid/exBasic/MyMath.java deleted file mode 100644 index 52a049d..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyMath.java +++ /dev/null @@ -1,231 +0,0 @@ -package jp.co.jid.exBasic; - -public class MyMath { - - /** - * 加算を行うメソッド - * @param num1 被加算数 - * @param num2 加算数 - * @return num1 + num2 を返す - */ - public int calcPlus(int num1, int num2) { - return num1 + num2; - } - - /** - * 減算を行うメソッド - * @param num1 被減算数 - * @param num2 減算数 - * @return num1 - num2 を返す - */ - public int calcMinus(int num1, int num2) { - return num1 - num2; - } - - /** - * 乗算を行うメソッド - * @param num1 被乗数 - * @param num2 乗数 - * @return num1 * num2 を返す - */ - public int calcTime(int num1, int num2) { - int result = 0; - for (int i = 0; i < num2; i++) { - result = calcPlus(result, num1); - } - return result; - } - - /** - * 除算(商を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @return num1 / num2 の商を返す - */ - public int calcDiv(int num1, int num2) { - return num1 / num2; - } - - /** - * 除算(余を求める)を行うメソッド - * @param num1 被除数 - * @param num2 除数 - * @retur num1 / num2 の余を返す - */ - public int calcMod(int num1, int num2) { - return calcMinus(num1, calcTime(calcDiv(num1, num2), num2)); - } - - /** - * 可変長変数の合計を求めるメソッド - * @param nums 可変長変数 - * @return 合計 - */ - public int calcSum(int... nums) { - int sum = 0; - for (int num : nums) { - sum += num; - } - return sum; - } - - /** - * 可変長変数の平均を求めるメソッド - * @param nums 可変長変数 - * @return 平均 - */ - public double calcAvg(int... nums) { - return (double)calcSum(nums) / nums.length; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum1(int fromNum, int toNum) { - int sum = 0; - for (int num = fromNum; num <= toNum; num++) { - sum += num; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum2(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - while (num <= toNum) { - sum += num++; - } - return sum; - } - - /** - * 第1引数から第2引数までカウントアップしながら、その時の値の和を返すメソッド - * @param fromNum カウントアップ開始の値 - * @param toNum カウントアップ終了の値 - * @return 合計 - */ - public int countUpSum3(int fromNum, int toNum) { - int sum = 0; - int num = fromNum; - do { - sum += num++; - } while (num <= toNum); - return sum; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数と第3引数の和 - * 2:第2引数と第3引数の差 - * 3:第2引数と第3引数の積 - * 4:第2引数と第3引数の商 - * 5:第2引数と第3引数の余 - * @param funcNum 度の処理を行うかの指定値 - * @param num1 - * @param num2 - * @return 計算結果 - */ - public int calc(int funcNum, int num1, int num2) { - switch (funcNum) { - case 1: - return calcPlus(num1, num2); - case 2: - return calcMinus(num1, num2); - case 3: - return calcTime(num1, num2); - case 4: - return calcDiv(num1, num2); - case 5: - return calcMod(num1, num2); - default: - return 0; - } - } - - /** - * 最大値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最大値 - */ - public int max(int... nums) { - int max = Integer.MIN_VALUE; - for (int num : nums) { - if (num > max) { - max = num; - } - } - return max; - } - - /** - * 最小値を求めるメソッド - * @param nums 検査対象の可変長変数 - * @return 最小値 - */ - public int min(int... nums) { - int min = Integer.MAX_VALUE; - for (int num : nums) { - if (num < min) { - min = num; - } - } - return min; - } - - /** - * 第1引数によって以下のように返す値を変更するメソッド - * 1:第2引数以降の合計値 - * 2:第2引数以降の平均値(整数部のみ) - * 3:第2引数以降の最大値 - * 4:第2引数以降の最小値 - * ただし、引数が1つの場合は「0」を返す。 - * @param nums 対象の可変長変数 - * @return 処理結果 - */ - public int calc2(int... nums) { - if (nums.length == 1) { - return 0; - } - switch (nums[0]) { - case 1: - int sum1 = 0; - for (int i = 1; i < nums.length; i++) { - sum1 += nums[i]; - } - return sum1; - case 2: - int sum2 = 0; - for (int i = 1; i < nums.length; i++) { - sum2 += nums[i]; - } - return sum2 / (nums.length - 1); - case 3: - int max = Integer.MIN_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] > max) { - max = nums[i]; - } - } - return max; - case 4: - int min = Integer.MAX_VALUE; - for (int i = 1; i < nums.length; i++) { - if (nums[i] < min) { - min = nums[i]; - } - } - return min; - default: - return 0; - } - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/MyString.java b/java-learning/src/jp/co/jid/exBasic/MyString.java deleted file mode 100644 index 7535907..0000000 --- a/java-learning/src/jp/co/jid/exBasic/MyString.java +++ /dev/null @@ -1,44 +0,0 @@ -package jp.co.jid.exBasic; - -public class MyString { - - public void beep(int count) { - for (int i = 0; i < count; i++) { - System.out.println("ビーーー"); - } - } - - public void branch(int func) { - switch (func) { - case 1: - System.out.println("おはようございます"); - return; - case 2: - System.out.println("こんにちは"); - return; - case 3: - System.out.println("こんばんは"); - return; - case 4: - System.out.println("おやすみなさい"); - return; - case 5: - System.out.println("また明日"); - return; - default: - System.out.println("さようなら。。。"); - } - } - - public String concat(String[] strArray) { - StringBuffer sb = new StringBuffer(); - for (String str : strArray) { - sb.append(str); - } - return sb.toString(); - } - - public String replace(String csvString) { - return csvString.replace(",", "\t"); - } -} diff --git a/java-learning/src/jp/co/jid/exBasic/Sex.java b/java-learning/src/jp/co/jid/exBasic/Sex.java deleted file mode 100644 index 2653862..0000000 --- a/java-learning/src/jp/co/jid/exBasic/Sex.java +++ /dev/null @@ -1,39 +0,0 @@ -package jp.co.jid.exBasic; - -public class Sex { - /** 性別:男 */ - public static final int SEX_MAN = 1; - /** 性別:女 */ - public static final int SEX_WOMAN = 2; - - /** 性別 */ - private int sex; - - /** - * コンストラクタ - * @param sex 性別(SEX_MAN:男, SEX_WOMAN:女) - */ - public Sex(int sex) { - this.sex = sex; - } - - /** - * 男か? - * @return 男ならtrueを返す - */ - public boolean isMan() { - return this.sex == SEX_MAN ? true : false; - } - - /** - * 女か? - * @return 女ならtrueを返す - */ - public boolean isWoman() { - return this.sex == SEX_WOMAN ? true : false; - } - - public int getSex() { - return this.sex; - } -}