diff --git a/Solutions/whiteWeed/Game Shop/3/Armor.java b/Solutions/whiteWeed/Game Shop/3/Armor.java new file mode 100644 index 0000000..c350fa6 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/Armor.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Armor + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 29. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Armor extends Item { + private int defence; + + public Armor(String name, String description, int weight, int value, int defence){ + super(name, description, weight, value); + this.defence = defence; + } + + public void describe(){ + super.describe(); + System.out.println("Defence = " + this.defence); + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/Item.java b/Solutions/whiteWeed/Game Shop/3/Item.java new file mode 100644 index 0000000..85ddf1c --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/Item.java @@ -0,0 +1,35 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Item + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 18. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Item { + protected String name, description; + protected int weight, value; + + public Item(String name, String description, int weight, int value){ + this.name = name; + this.description = description; + this.weight = weight; + this.value = value; + } + + public void describe(){ + System.out.println("Name = " + this.name); + System.out.println("Description = " + this.description); + System.out.println("Weight = " + this.weight + " lbs"); + System.out.println("Value = " + this.value + " gold coins"); + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/ItemTest.java b/Solutions/whiteWeed/Game Shop/3/ItemTest.java new file mode 100644 index 0000000..e5cc9b8 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/ItemTest.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_ItemTest + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 18. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class ItemTest { + public static void main(String[] args) { + Item[] items = { + new Item("Excalibur", "The legendary sword of King Arthur", 12, 1024), + new Item("Steel Armor", "Protective covering made by steel", 15, 805) + }; + + for(Item item : items){ + item.describe(); + System.out.println(); + } + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/ItemTest2.java b/Solutions/whiteWeed/Game Shop/3/ItemTest2.java new file mode 100644 index 0000000..244ae14 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/ItemTest2.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_ItemTest2 + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 29. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class ItemTest2 { + public static void main(String[] args) { + Item[] items = { + new Weapon("Excalibur", "The legendary sword of King Arthur", 12, 1024, 24), + new Armor("Steel Armor", "Protective covering made by steel", 15, 805, 18) + }; + + for(Item item : items){ + item.describe(); + System.out.println(); + } + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/Potion.java b/Solutions/whiteWeed/Game Shop/3/Potion.java new file mode 100644 index 0000000..b1534dd --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/Potion.java @@ -0,0 +1,33 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Potion + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 5. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Potion extends Item { + String type; + int capacity; + + public Potion(String name, String description, int weight, int value, String type, int capacity){ + super(name, description, weight, value); + this.type = type; + this.capacity = capacity; + } + + public void describe(){ + super.describe(); + System.out.println("Type = " + this.type); + System.out.println("Capacity = " + this.capacity); + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/Shop.java b/Solutions/whiteWeed/Game Shop/3/Shop.java new file mode 100644 index 0000000..446d3e5 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/Shop.java @@ -0,0 +1,35 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Shop + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 5. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Shop { + String name; + Item[] items; + + public Shop(String name, Item[] items){ + this.name = name; + this.items = items; + } + + public void showItemList(){ + System.out.println("Welcome to " + this.name + " Shop!"); + System.out.println("- Item List -"); + for(Item item : items){ + item.describe(); + System.out.println(); + } + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/ShopTest.java b/Solutions/whiteWeed/Game Shop/3/ShopTest.java new file mode 100644 index 0000000..8897234 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/ShopTest.java @@ -0,0 +1,72 @@ +/** + * + */ +package whiteWeed.gameShop; + +import java.util.*; + +/** + *
+ * whiteWeed.gameShop + * |_ShopTest + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 5. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class ShopTest { + private static Item[][] items = { + { + new Weapon("Sword", "Medium DMG", 3, 10, 10), + new Armor("Cap", "Light Armor", 1, 5, 5), + new Armor("Gloves", "Light Armor", 1, 5, 5), + new Weapon("Axe", "High DMG", 5, 15, 15), + new Armor("Boots", "Light Armor", 1, 5, 5) + }, + { + new Potion("Small Health Potion", "Recovery 100 HP", 2, 5, "Health", 100), + new Potion("Small Mana Potion", "Recovery 50 MP", 1, 30, "Mana", 50), + new Potion("Medium Health Potion", "Recovery 200 HP", 4, 120, "Health", 200), + new Potion("Medium Mana Potion", "Recovery 100 MP", 2, 75, "Mana", 100), + new Potion("Large Health Potion", "Recovery 300 HP", 6, 200, "Health", 300) + } + }; + private static Shop[] shops = { + new Shop("Weapon/Armor", items[0]), + new Shop("Potion", items[1]) + }; + + private static Scanner sc = new Scanner(System.in); + + public static void main(String[] args) { + boolean end = true; + while(end) { + end = select(); + } + sc.close(); + } + + public static boolean select(){ + System.out.println("- Shop Select -"); + System.out.println(" 1. Weapon/Armor Shop"); + System.out.println(" 2. Potion Shop"); + System.out.println(" 3. Exit"); + System.out.println(); + System.out.println("Select : "); + int selection = sc.nextInt(); + sc.reset(); + + if(selection > 3 || selection <= 0){ + System.out.println("Invalid number! Try again."); + return true; + } + else if(selection <= 2){ + shops[selection - 1].showItemList(); + return true; + } + return false; + } +} diff --git a/Solutions/whiteWeed/Game Shop/3/Weapon.java b/Solutions/whiteWeed/Game Shop/3/Weapon.java new file mode 100644 index 0000000..a291c6d --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/3/Weapon.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Weapon + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 29. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Weapon extends Item { + private int damage; + + public Weapon(String name, String description, int weight, int value, int damage){ + super(name, description, weight, value); + this.damage = damage; + } + + public void describe(){ + super.describe(); + System.out.println("Damage = " + this.damage); + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/Armor.java b/Solutions/whiteWeed/Game Shop/4/Armor.java new file mode 100644 index 0000000..e98baea --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/Armor.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Armor + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 29. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Armor extends Item { //ㅁㄴㅇㄹ + private int defence; + + public Armor(String name, String description, int weight, int value, int defence){ + super(name, description, weight, value); + this.defence = defence; + } + + public void describe(){ + super.describe(); + System.out.println("Defence = " + this.defence); + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/Item.java b/Solutions/whiteWeed/Game Shop/4/Item.java new file mode 100644 index 0000000..5c3b46a --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/Item.java @@ -0,0 +1,35 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Item + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 18. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Item { //ㅁㄴㅇㄹ + protected String name, description; + protected int weight, value; + + public Item(String name, String description, int weight, int value){ + this.name = name; + this.description = description; + this.weight = weight; + this.value = value; + } + + public void describe(){ + System.out.println("Name = " + this.name); + System.out.println("Description = " + this.description); + System.out.println("Weight = " + this.weight + " lbs"); + System.out.println("Value = " + this.value + " gold coins"); + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/Potion.java b/Solutions/whiteWeed/Game Shop/4/Potion.java new file mode 100644 index 0000000..f3fb3a9 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/Potion.java @@ -0,0 +1,33 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Potion + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 5. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Potion extends Item { //ㅁㄴㅇㄹ + String type; + int capacity; + + public Potion(String name, String description, int weight, int value, String type, int capacity){ + super(name, description, weight, value); + this.type = type; + this.capacity = capacity; + } + + public void describe(){ + super.describe(); + System.out.println("Type = " + this.type); + System.out.println("Capacity = " + this.capacity); + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/Shop.java b/Solutions/whiteWeed/Game Shop/4/Shop.java new file mode 100644 index 0000000..589828d --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/Shop.java @@ -0,0 +1,92 @@ +/** + * + */ +package whiteWeed.gameShop; + +import java.io.*; +import java.util.*; + +/** + *
+ * whiteWeed.gameShop + * |_Shop + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 5. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Shop { //ㅁㄴㅇㄹ + String name; + Item[] itemsArray; + List
+ * whiteWeed.gameShop + * |_ShopTest2 + * + * 1. 개요 : + * 2. 작성일 : 2017. 7. 3. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class ShopTest2 { //ㅁㄴㅇㄹ + private static Shop[] shops = { + new Shop("Weapon/Armor", "equip_item.txt"), + new Shop("Potion", "potion_item.txt") + }; + + private static Scanner sc = new Scanner(System.in); + + public static void main(String[] args) { + boolean end = true; + while(end) { + end = select(); + } + sc.close(); + } + + public static boolean select(){ + System.out.println("- Shop Select -"); + System.out.println(" 1. Weapon/Armor Shop"); + System.out.println(" 2. Potion Shop"); + System.out.println(" 3. Exit"); + System.out.println(); + System.out.print("Select : "); + int selection = sc.nextInt(); + sc.reset(); + + if(selection > 3 || selection <= 0){ + System.out.println("Invalid number! Try again."); + return true; + } + else if(selection <= 2){ + shops[selection - 1].showItemArrayList(); + return true; + } + return false; + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/Weapon.java b/Solutions/whiteWeed/Game Shop/4/Weapon.java new file mode 100644 index 0000000..35a8925 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/Weapon.java @@ -0,0 +1,30 @@ +/** + * + */ +package whiteWeed.gameShop; + +/** + *
+ * whiteWeed.gameShop + * |_Weapon + * + * 1. 개요 : + * 2. 작성일 : 2017. 5. 29. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Weapon extends Item { + private int damage; //ㅁㄴㅇㄹ + + public Weapon(String name, String description, int weight, int value, int damage){ + super(name, description, weight, value); + this.damage = damage; + } + + public void describe(){ + super.describe(); + System.out.println("Damage = " + this.damage); + } +} diff --git a/Solutions/whiteWeed/Game Shop/4/equip_item.txt b/Solutions/whiteWeed/Game Shop/4/equip_item.txt new file mode 100644 index 0000000..168a930 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/equip_item.txt @@ -0,0 +1,5 @@ +"Weapon", "Sword", "Medium DMG", 3, 10, 10 +"Armor", "Cap", "Light Armor", 1, 5, 5 +"Armor", "Gloves", "Light Armor", 1, 5, 5 +"Weapon", "Axe", "High DMG", 5, 15, 15 +"Armor", "Boots", "Light Armor", 1, 5, 5 \ No newline at end of file diff --git a/Solutions/whiteWeed/Game Shop/4/potion_item.txt b/Solutions/whiteWeed/Game Shop/4/potion_item.txt new file mode 100644 index 0000000..30a9c21 --- /dev/null +++ b/Solutions/whiteWeed/Game Shop/4/potion_item.txt @@ -0,0 +1,5 @@ +"Potion", "Small Health Potion", "Recovery 100 HP", 2, 5, "Health", 100 +"Potion", "Small Mana Potion", "Recovery 50 MP", 1, 30, "Mana", 50 +"Potion", "Medium Health Potion", "Recovery 200 HP", 4, 120, "Health", 200 +"Potion", "Medium Mana Potion", "Recovery 100 MP", 2, 75, "Mana", 100 +"Potion", "Large Health Potion", "Recovery 300 HP", 6, 200, "Health", 300 \ No newline at end of file diff --git a/Solutions/whiteWeed/Grade Management System/2/Grade2.java b/Solutions/whiteWeed/Grade Management System/2/Grade2.java new file mode 100644 index 0000000..3ec92d7 --- /dev/null +++ b/Solutions/whiteWeed/Grade Management System/2/Grade2.java @@ -0,0 +1,51 @@ +/** + * + */ +package whiteWeed.gradeManage; + +/** + *
+ * whiteWeed.gradeManage + * |_Grade2 + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 2. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class Grade2 { //ㅁㄴㅇㄹ + private String name; + private short sum = 0, rank; + private float average; + protected byte[] score; + public static byte[] scoreSum = {0, 0, 0, 0}; + public static int studentCnt = 0; + + public Grade2(String name, byte[] score, short sum, float average){ + this.name = name; + this.score = score; + this.sum = sum; + this.average = average; + studentCnt++; + for(int i = 0; i < 3; i++){ + scoreSum[i] += score[i]; + } + scoreSum[3] += sum; + } + + public short getSum(){ + return sum; + } + + public void setRank(short rank){ + this.rank = rank; + } + + public String toString(){ + return String.format("%-10s", this.name) + String.format("%-6d", this.score[0]) + String.format("%-6d", this.score[1]) + + String.format("%-6d", this.score[2]) + String.format("%-6d", this.sum) + String.format("%-6.1f", this.average) + + String.format("%-3d", this.rank); + } +} diff --git a/Solutions/whiteWeed/Grade Management System/2/GradeTest2.java b/Solutions/whiteWeed/Grade Management System/2/GradeTest2.java new file mode 100644 index 0000000..657a4e0 --- /dev/null +++ b/Solutions/whiteWeed/Grade Management System/2/GradeTest2.java @@ -0,0 +1,133 @@ +/** + * + */ +package whiteWeed.gradeManage; + +import java.util.*; + +/** + *
+ * whiteWeed.gradeManage + * |_GradeTest2 + * + * 1. 개요 : + * 2. 작성일 : 2017. 6. 2. + *+ * + * @author : Weed + * @version : 1.0 + */ +public class GradeTest2 { //ㅁㄴㅇㄹ + + private static Scanner sc = new Scanner(System.in); + private static List