Java-1(2014) 14. Hafta Uygulamaları
abstract class AlanHesapla { public abstract void alan(int a,int b); public void hesapla(int a, int b) { alan(a,b); } } class dortgen extends AlanHesapla { public void alan(int a, int b) { double sonuc=a*b; System.out.println("Dortgen:"+sonuc); } } class ucgen extends AlanHesapla { public void alan(int a, int b) { double sonuc=a*b/2; System.out.println("Ucgen:"+sonuc); } } class silindir extends AlanHesapla { public void alan(int a, int b) { double sonuc=2*3.14*a*(a+b); System.out.println("Silindir:"+sonuc); } } public class ornek { public static void main(String[] params) { dortgen d= new dortgen(); d.hesapla(1,2); ucgen u= new ucgen(); u.hesapla(1,2); silindir s= new silindir(); s.hesapla(1,2); } }