https://www.youtube.com/watch?v=y-qUWhanlkM&t=379s
public class AccountingIFApp {
public static void main(String[] args) {
double valueOfSupply = Double.parseDouble(args[0]);
double vatRate = 0.1;
double expenseRate = 0.3;
double vat = valueOfSupply*vatRate;
double total = valueOfSupply + vat;
double expense = valueOfSupply*expenseRate;
double income = valueOfSupply - expense;
double dividend1;
double dividend2;
double dividend3;
if (10000.0 < income) {
dividend1 = income * 0.5;
dividend2 = income * 0.3;
dividend3 = income * 0.2;
} else {
dividend1 = income * 0.1;
dividend2 = income * 0.0;
dividend3 = income * 0.0;
}
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("Dividend1 : " + dividend1 );
System.out.println("Dividend2 : " + dividend2 );
System.out.println("Dividend3 : " + dividend3 );
}
}
Program arguments를 적용할 경우
public static void main(String[] args) {
double valueOfSupply = Double.parseDouble(args[0]);
>>여기에 적용이된다.
여러개의 값도 적용가능함
>>'5000.0' '10000.0'
'생활코딩 > 생활코딩 Java' 카테고리의 다른 글
Java1_나의 앱 만들기_클래스 (0) | 2021.10.11 |
---|---|
Java1_나의 앱 만들기_Method (0) | 2021.10.11 |
Java1_나의 앱 만들기_반복문 (0) | 2021.10.11 |
Java1_나의 앱 만들기_Array (0) | 2021.10.11 |
Java1_나의 앱 만들기 (0) | 2021.10.11 |