/*
* 본 코드는 생활코딩 Java 수업을 위해서 만들어진 코드입니다.
* http://o...content-available-to-author-only...s.org/module/516
* 누구든지 이 코드를 이용해서 원하는데로 사용할 수 있습니다. (public domain)
* 본 코드는 아래 수업에서 활용되고 있습니다.
* 실제 수업의 내용과 ideone.com의 코드는 다를 수 있습니다.
* ideone.com 플랫폼의 특성 때문입니다.
*/
import java.util.*;
import java.lang.*;
import java.io.*;
class Calculator {
int left, right;
public Calculator(int left, int right) {
this.left = left;
this.right = right;
}
public void sum() {
System.
out.
println(this.
left + this.
right); }
public void avg() {
System.
out.
println((this.
left + this.
right) / 2); }
}
class CalculatorDemo1 {
public static void main
(String[] args
) {
Calculator c1 = new Calculator(10, 20);
c1.sum();
c1.avg();
Calculator c2 = new Calculator(20, 40);
c2.sum();
c2.avg();
}
}
LyoKKiDrs7gg7L2U65Oc64qUIOyDne2ZnOy9lOuUqSBKYXZhIOyImOyXheydhCDsnITtlbTshJwg66eM65Ok7Ja07KeEIOy9lOuTnOyeheuLiOuLpC4gCiogaHR0cDovL28uLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLnMub3JnL21vZHVsZS81MTYKKiDriITqtazrk6Dsp4Ag7J20IOy9lOuTnOulvCDsnbTsmqntlbTshJwg7JuQ7ZWY64qU642w66GcIOyCrOyaqe2VoCDsiJgg7J6I7Iq164uI64ukLiAocHVibGljIGRvbWFpbikKKiDrs7gg7L2U65Oc64qUIOyVhOuemCDsiJjsl4Xsl5DshJwg7Zmc7Jqp65CY6rOgIOyeiOyKteuLiOuLpC4KKiDsi6TsoJwg7IiY7JeF7J2YIOuCtOyaqeqzvCBpZGVvbmUuY29t7J2YIOy9lOuTnOuKlCDri6Trpbwg7IiYIOyeiOyKteuLiOuLpC4gCiogaWRlb25lLmNvbSDtlIzrnqvtj7zsnZgg7Yq57ISxIOuVjOusuOyeheuLiOuLpC4KKi8KIAppbXBvcnQgamF2YS51dGlsLio7CmltcG9ydCBqYXZhLmxhbmcu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