İyinet'e Hoşgeldiniz!

Türkiye'nin En Eski Webmaster Forum'una Hemen Kayıt Olun!

Kayıt Ol!

Java ile console uygulamasında not hesaplama programı

Bolu Beyi

0
İyinet Üyesi
Katılım
7 Nisan 2010
Mesajlar
2,895
Reaction score
36
package ogrencinothesap;

class ogrenci
{
private String isim;
private int ogrenciNo;
private double vizeNotu;
private double projeNotu;
private double finalNotu;

public void setIsim(String isim)
{
this.isim=isim;
}
public String getIsim()
{
return this.isim;
}
public void setOgrenciNo(int ogrenciNo)
{
this.ogrenciNo=ogrenciNo;
}
public void setVizeNotu(byte vizeNotu)
{
this.vizeNotu=vizeNotu;
}
public void setProjeNotu(byte projeNotu)
{
this.projeNotu=projeNotu;
}
public void setFinalNotu(byte finalNotu)
{
this.finalNotu=finalNotu;
}

public double notHesapla()
{
return (vizeNotu*25/100)+(projeNotu*35/100)+(finalNotu*40/100);
}

public String harfNotuHesapla(double not)
{
if(not>=90)
return "AA";
else if(not>=85)
return "BA";
else if(not>=75)
return "BB";
else if(not>=70)
return "CB";
else if(not>=60)
return "CC";
else if(not>=55)
return "DC";
else if(not>=50)
return "DD";
else
return "FF";
}
}

public class OgrenciNotHesap {
public static void main(String[] args)
{
ogrenci ogr=new ogrenci();

ogr.setIsim("Serkan Şentürk");
ogr.setOgrenciNo(152301);
ogr.setVizeNotu((byte)90);
ogr.setProjeNotu((byte)54);
ogr.setFinalNotu((byte)83);

System.out.print("Ögrenci Adı : " + ogr.getIsim() + "\nNot : " + ogr.notHesapla() + "\nHarf : " + ogr.harfNotuHesapla(ogr.notHesapla()));
}
}

Kaynak: blogsahin
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Üst