added old projects
This commit is contained in:
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin"
|
||||
}
|
||||
@@ -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).
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
public class Tester {
|
||||
public static void main(String[] args) throws Exception {
|
||||
//System.out.println("Hello, World!");
|
||||
//System.out.println(Utilities.ceiling(-1.2));
|
||||
//System.out.println(Utilities.ceiling(3));
|
||||
//System.out.println(Utilities.ceiling(1.6));
|
||||
System.out.println(Utilities.stars(5));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class Utilities {
|
||||
|
||||
public static int abs(int num) {
|
||||
if (num < 0)
|
||||
num *= -1;
|
||||
return num;
|
||||
}
|
||||
|
||||
public static int ceiling(double num) {
|
||||
double x = num % 1;
|
||||
if (x < .5)
|
||||
num -= x;
|
||||
else if (x >= .5)
|
||||
num += x;
|
||||
return (int) num;
|
||||
}
|
||||
|
||||
public static BigInteger fact(int x) {
|
||||
BigInteger fact = new BigInteger("1");
|
||||
|
||||
for (int i = 2; i <= x; i++)
|
||||
fact = fact.multiply(BigInteger.valueOf(i));
|
||||
|
||||
return fact;
|
||||
}
|
||||
|
||||
public static String stars(int x) {
|
||||
String s = "";
|
||||
|
||||
for (int i = 1; i <= x; ++i) {
|
||||
for (int j = 1; j <= i; ++j) {
|
||||
s += "*";
|
||||
}
|
||||
s += " ";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user