Nesne Tabanlı Programlama (Güz-2016) Hafta-11

public abstract class ogrenci{

	String[] harfler={"AA","BA","BB","CB","CC","DC","DD","FD"};
	int[] sinirlar={90,80,70,60,50,40,35,30};
	
	abstract int ortalamahesap();
	
	
	/*int ortalamahesap()
	{
		return (int) (vizenot*0.4+finalnot*0.6 + 0.5);
	}*/


	void harfhesapla()
	{
		int ortalama = ortalamahesap();	
		for(int i =0;i<harfler.length;i++)
		{
			if(ortalama>=sinirlar[i])
			{
				System.out.println(ortalama+" ortalama icin harf: "+harfler[i]);
				return;
			}
		}
		
		System.out.println(ortalama+" ortalama icin harf: FF");
	}


}
public class calistir extends ogrenci
{
	public calistir()
	{
		harfhesapla();	
	}
	int ortalamahesap()
	{
		// hesaplama algoritmasi
		return 70;
	}
	public static void main(String[] asdad)
	{
		new calistir();
	}

}

 

Share