Spring/JAVA

์•ฑ ๋งŒ๋“ค๊ธฐ 1 - ๋ฐฐ๋‹น๊ธˆ ๊ณ„์‚ฐ๊ธฐ (๋ณ€์ˆ˜, ์ž…๋ ฅ๊ฐ’)

alsruds 2023. 9. 22. 22:23
๐Ÿฃ์ƒํ™œ์ฝ”๋”ฉ ๊ฐ•์˜๐Ÿฃ

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 ์„ค์ •ํ•˜๊ธฐ

์ ์šฉํ•  ํด๋ž˜์Šค + 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

 

cmd ๋กœ ์‹คํ–‰ ์„ฑ๊ณต !