Created
February 12, 2023 23:42
-
-
Save MocaaDevv/590c114d0df8a73fbe1e52782c6316eb to your computer and use it in GitHub Desktop.
Bu Java programı, bir kullanıcının doğum tarihini ve burcunu hesaplamak için tasarlandı. Program, kullanıcının doğum yılını, ayını ve gününü girmesini ister. Daha sonra, program kullanıcının burcunu ve yaşını hesaplar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class BurcHesaplama { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.print("Doğum Tarihi (DD/MM/YYYY): "); | |
| String doğumTarihi = input.nextLine(); | |
| String[] doğumTarihiArray = doğumTarihi.split("/"); | |
| int gün = Integer.parseInt(doğumTarihiArray[0]); | |
| int ay = Integer.parseInt(doğumTarihiArray[1]); | |
| int yıl = Integer.parseInt(doğumTarihiArray[2]); | |
| int yaş = 2023 - yıl; | |
| String burç; | |
| if (ay == 3 && gün >= 21 || ay == 4 && gün <= 20) { | |
| burç = "Koç"; | |
| } else if (ay == 4 && gün >= 21 || ay == 5 && gün <= 20) { | |
| burç = "Boğa"; | |
| } else if (ay == 5 && gün >= 21 || ay == 6 && gün <= 21) { | |
| burç = "İkizler"; | |
| } else if (ay == 6 && gün >= 22 || ay == 7 && gün <= 22) { | |
| burç = "Yengeç"; | |
| } else if (ay == 7 && gün >= 23 || ay == 8 && gün <= 23) { | |
| burç = "Aslan"; | |
| } else if (ay == 8 && gün >= 24 || ay == 9 && gün <= 23) { | |
| burç = "Başak"; | |
| } else if (ay == 9 && gün >= 24 || ay == 10 && gün <= 23) { | |
| burç = "Terazi"; | |
| } else if (ay == 10 && gün >= 24 || ay == 11 && gün <= 22) { | |
| burç = "Akrep"; | |
| } else if (ay == 11 && gün >= 23 || ay == 12 && gün <= 21) { | |
| burç = "Yay"; | |
| } else if (ay == 12 && gün >= 22 || ay == 1 && gün <= 20) { | |
| burç = "Oğlak"; | |
| } else if (ay == 1 && gün >= 21 || ay == 2 && gün <= 18) { | |
| burç = "Kova"; | |
| } else { | |
| burç = "Hatalı doğum tarihi girdiniz"; | |
| } | |
| System.out.println("Burç: " + burç + "\nYaşınız: " + yaş); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment