๐ฃ์ํ์ฝ๋ฉ ๊ฐ์๐ฃ
JAVA1 - 14.1. ๋์ ์ฑ ๋ง๋ค๊ธฐ - ์ค๋ฆฌ์ํ ์ด์
https://www.youtube.com/watch?v=mphrv80VaQI&list=PLuHgQVnccGMAIluRRVsC1e79ri-dwnBmR&index=39
JAVA1 - 14.2. ๋์ ์ฑ ๋ง๋ค๊ธฐ - ๊ธฐ๋ณธ ๊ธฐ๋ฅ ๊ตฌํ
https://www.youtube.com/watch?v=RSTVfycyssA&list=PLuHgQVnccGMAIluRRVsC1e79ri-dwnBmR&index=40
JAVA1 - 14.3. ๋์ ์ฑ ๋ง๋ค๊ธฐ - ๋ณ์ ๋์
https://www.youtube.com/watch?v=7Wg74I0QLaE&list=PLuHgQVnccGMAIluRRVsC1e79ri-dwnBmR&index=41
JAVA1 - 14.4. ๋์ ์ฑ ๋ง๋ค๊ธฐ - ์ ๋ ฅ๊ฐ ๋์
https://www.youtube.com/watch?v=iYPQ20VgQUU&list=PLuHgQVnccGMAIluRRVsC1e79ri-dwnBmR&index=42
๋ฌธ์ ์ํฉ ์ธ์ํ๊ธฐ
โ๏ธ ์๋น์๊ฐ ํ๋งค์์๊ฒ (๊ณต๊ธ๊ฐ + ๋ถ๊ฐ์ธ) ์ง๋ถ ํ ๋ฌผ๊ฑด ๊ตฌ์
โ๏ธ ๊ณต๊ธ๊ฐ์์ ๋น์ฉ์ ์ ์ธํ ์์ด์ต ๋ฐ์
โ๏ธ ์ด์ต์ ๋ถ๋ฐฐ (๋ฐฐ๋น๊ธ)
์ฝ๋ ์์ฑํ๊ธฐ
public class Main {
public static void main(String[] args) {
double valueOfSupply = Double.parseDouble(args[0]);
double vatRate = 0.1;
double vat = valueOfSupply * vatRate;
double total = valueOfSupply + vat;
double expenseRate = 0.3;
double expense = valueOfSupply * expenseRate;
double income = valueOfSupply - expense;
double dividend1 = income * 0.5;
double dividend2 = income * 0.3;
double dividend3 = income * 0.2;
System.out.println("Value of supply: "+valueOfSupply);
System.out.println("VAT: "+vat);
System.out.println("Total: "+total);
System.out.println("Expense: "+expense);
System.out.println("Income: "+income);
System.out.println("Dividend 1: "+dividend1);
System.out.println("Dividend 2: "+dividend2);
System.out.println("Dividend 3: "+dividend3);
}
}
โ ํ ์คํธ ํ๊ธฐ
โ๏ธ Argument ์ค์ ํ๊ธฐ
โ๏ธ Run
cmd ์์ ์คํํ๊ธฐ
// ํ๋ก์ ํธ ๊ฒฝ๋ก๋ก ์ด๋ : cd [project path]
cd C:\Users\alsrud\IdeaProjects\Setting\src
// ๋๋ ํ ๋ฆฌ ๋ด ํ์ผ ํ์ธํ๊ธฐ : dir (Windows) | ls (MAC)
dir
// ํด๋์ค ์คํํ๊ธฐ : java [class name] [args]
java Main.java 20000.0
'Spring > JAVA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Java ์์ธ (Try-Catch / Try-Catch-Finally / Try with Resource Statements / Throws) (0) | 2023.09.26 |
---|---|
์ฑ ๋ง๋ค๊ธฐ 2 - ๋ฐฐ๋น๊ธ ๊ณ์ฐ๊ธฐ (์ ์ด๋ฌธ, ๋ฐฐ์ด, ๋ฉ์๋, ํด๋์ค, ์ธ์คํด์ค) (0) | 2023.09.25 |
๋ณ์ (0) | 2023.09.21 |
๋ฐ์ดํฐ (์ซ์, ๋ฌธ์์ด) ๋ค๋ฃจ๊ธฐ (0) | 2023.09.20 |
Hello World & Java ๋์ ์๋ฆฌ (0) | 2023.09.20 |