Hesap Makinesi(Switch-Case)

Hesap Makinesi(Switch-Case) yapımı.

[pastacode lang=”java” manual=”import%20java.util.Scanner%3B%0A%0Apublic%20class%20HesapMakinesi%20%7B%0A%0A%09public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%09%09%2F%2F%20TODO%20Auto-generated%20method%20stub%0A%09%09double%20sonuc%3B%0A%09%09Scanner%20sc%3Dnew%20Scanner(System.in)%3B%0A%09%09System.out.println(%22%C4%B0lk%20say%C4%B1y%C4%B1%20giriniz…%22)%3B%0A%09%09int%20sayi1%3Dsc.nextInt()%3B%0A%09%09System.out.println(%22%C4%B0kinci%20say%C4%B1y%C4%B1%20giriniz…%22)%3B%0A%09%09int%20sayi2%3Dsc.nextInt()%3B%0A%09%09System.out.println(%221-Toplama%20%5Cn%202-%C3%87%C4%B1karma%20%5Cn%203-%C3%87arpma%20%5Cn%204-B%C3%B6lme%22)%3B%0A%09%09System.out.println(%22Se%C3%A7iminiz…%22)%3B%0A%09%09int%20secim%3Dsc.nextInt()%3B%0A%09%09switch%20(secim)%20%7B%0A%09%09case%201%3A%20%7B%0A%09%09sonuc%3Dsayi1%2Bsayi2%3B%0A%09%09System.out.println(sonuc)%3B%0A%09%09break%3B%0A%09%09%09%0A%09%09%7D%0A%09%09case%202%3A%20%7B%0A%09%09%09sonuc%3Dsayi1-sayi2%3B%0A%09%09%09System.out.println(sonuc)%3B%0A%09%09%09break%3B%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09case%203%3A%20%7B%0A%09%09%09sonuc%3Dsayi1*sayi2%3B%0A%09%09%09System.out.println(sonuc)%3B%0A%09%09%09break%3B%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09case%204%3A%20%7B%0A%09%09%09%0A%09%09%09sonuc%3D(sayi2!%3D0)%3Fsayi1%2Fsayi2%3A-1%3B%0A%09%09%09System.out.println(sonuc)%3B%0A%09%09%09break%3B%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09default%3A%0A%09%09%09System.out.println(%22Yanl%C4%B1%C5%9F%20Se%C3%A7im%20yapt%C4%B1n%C4%B1z..%22)%3B%0A%09%09%7D%0A%09%09%0A%09%7D%0A%7D” message=”” highlight=”” provider=”manual”/]

admin