-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"java.project.sourcePaths": ["src"], | ||
"java.project.outputPath": "bin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Getting Started | ||
|
||
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. | ||
|
||
## Folder Structure | ||
|
||
The workspace contains two folders by default, where: | ||
|
||
- `src`: the folder to maintain sources | ||
- `lib`: the folder to maintain dependencies | ||
|
||
Meanwhile, the compiled output files will be generated in the `bin` folder by default. | ||
|
||
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. | ||
## Dependency Management | ||
|
||
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package coding.samguk; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class App { | ||
public void testCreateSomeGenerals() { | ||
General 조홍 = new General("조홍", (218-50-1), 74, 47, 75, 41, 74, 72); | ||
General 제갈량 = new General("제갈량", 181, 61, 100, 95, 92, 92, 78); | ||
|
||
List<General> generals = Arrays.asList(조홍, 제갈량); | ||
System.out.println(generals); | ||
} | ||
|
||
|
||
public static void main(String[] args) throws Exception { | ||
System.out.println("Hello, Coding Samguk V0!"); | ||
App app = new App(); | ||
|
||
//1. 몇 명의 장수 만들어 보기 | ||
app.testCreateSomeGenerals(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package coding.samguk; | ||
|
||
public class General { | ||
private String name; | ||
|
||
private int year; //태어난 해 | ||
private int warAbility; //무력 | ||
private int intelligence; //지력 | ||
private int charisma; //매력 | ||
private int politics; //정치력 | ||
private int armyCommand; //육전지휘 | ||
private int navalCommand; //수전지휘 | ||
|
||
private int army; //병사수 | ||
private int armyType; //병종 | ||
|
||
public General(String n, | ||
int y, int w, int i, int c, int p, | ||
int ac, int nc) { | ||
name = n; | ||
year = y; | ||
warAbility = w; | ||
intelligence = i; | ||
charisma = c; | ||
politics = p; | ||
armyCommand = ac; | ||
navalCommand = nc; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append(name).append(",").append(year).append("::") | ||
.append(warAbility).append(",").append(intelligence).append(",") | ||
.append(charisma).append(",").append(politics).append("::") | ||
.append(armyCommand).append(",").append(navalCommand); | ||
return sb.toString(); | ||
} | ||
} |