수업소개
배우지 않은 개념을 이용해서 나의 앱을 만들어봅시다. 앞으로 여러분이 공부해볼만한 주제들을 소개하는 시간이기도 합니다. 다 보려고 하지 마시고, 흥미 있는 부분까지만 보시면 됩니다.
강의 5
강의 6
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 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 (income > 10000.0 ) { dividend1 = income * 0.5 ; dividend2 = income * 0.3 ; dividend3 = income * 0.2 ; } else { dividend1 = income * 1.0 ; dividend2 = income * 0 ; dividend3 = income * 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( "Dividend 1 : " + dividend1); System.out.println( "Dividend 2 : " + dividend2); System.out.println( "Dividend 3 : " + dividend3); } } |
강의 7
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | public class AccountingArrayApp { 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 [] dividendRates = new double [ 3 ]; dividendRates[ 0 ] = 0.5 ; dividendRates[ 1 ] = 0.3 ; dividendRates[ 2 ] = 0.2 ; double dividend1 = income * dividendRates[ 0 ]; double dividend2 = income * dividendRates[ 1 ]; double dividend3 = income * dividendRates[ 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); } } |
강의 8
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | public class AccountingArrayLoopApp { 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; 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); double [] dividendRates = new double [ 3 ]; dividendRates[ 0 ] = 0.5 ; dividendRates[ 1 ] = 0.3 ; dividendRates[ 2 ] = 0.2 ; int i = 0 ; while (i < dividendRates.length) { System.out.println( "Dividend : " + (income*dividendRates[i]) ); i = i + 1 ; } } } |
강의 9
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | public class AccountingMethodApp { public static double valueOfSupply; public static double vatRate; public static double expenseRate; public static void main(String[] args) { valueOfSupply = 10000.0 ; vatRate = 0.1 ; expenseRate = 0.3 ; print(); } public static void print() { System.out.println( "Value of supply : " + valueOfSupply); System.out.println( "VAT : " + getVAT()); System.out.println( "Total : " + getTotal()); System.out.println( "Expense : " + getExpense()); System.out.println( "Income : " + getIncome()); System.out.println( "Dividend 1 : " + getDiviend1()); System.out.println( "Dividend 2 : " + getDiviend2()); System.out.println( "Dividend 3 : " + getDiviend3()); } public static double getDiviend1() { return getIncome() * 0.5 ; } public static double getDiviend2() { return getIncome() * 0.3 ; } public static double getDiviend3() { return getIncome() * 0.2 ; } public static double getIncome() { return valueOfSupply - getExpense(); } public static double getExpense() { return valueOfSupply * expenseRate; } public static double getTotal() { return valueOfSupply + getVAT(); } public static double getVAT() { return valueOfSupply * vatRate; } } |
강의 10
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | class Accounting{ public static double valueOfSupply; public static double vatRate; public static double expenseRate; public static void print() { System.out.println( "Value of supply : " + valueOfSupply); System.out.println( "VAT : " + getVAT()); System.out.println( "Total : " + getTotal()); System.out.println( "Expense : " + getExpense()); System.out.println( "Income : " + getIncome()); System.out.println( "Dividend 1 : " + getDiviend1()); System.out.println( "Dividend 2 : " + getDiviend2()); System.out.println( "Dividend 3 : " + getDiviend3()); } public static double getDiviend1() { return getIncome() * 0.5 ; } public static double getDiviend2() { return getIncome() * 0.3 ; } public static double getDiviend3() { return getIncome() * 0.2 ; } public static double getIncome() { return valueOfSupply - getExpense(); } public static double getExpense() { return valueOfSupply * expenseRate; } public static double getTotal() { return valueOfSupply + getVAT(); } public static double getVAT() { return valueOfSupply * vatRate; } } public class AccountingClassApp { public static void main(String[] args) { Accounting.valueOfSupply = 10000.0 ; Accounting.vatRate = 0.1 ; Accounting.expenseRate = 0.3 ; Accounting.print(); // anotherVariable = ...; // anotherMethod = ...; } } |