learningjava/26june2025/Main.java
2025-06-27 11:23:46 +03:00

124 lines
5.2 KiB
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import java.io.*;
import java.sql.SQLOutput;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
//System.out.println(denememet("deneme"));
System.out.println(!("Bash" == "piton" && "ve mantık" == "konusu") || 2 == 3);
System.out.println(1 > 2);
System.out.println((2 + 3) >= (3 + 2));
System.out.println("Hayat" != "güzel");
//denemecase();
Scanner scanner = new Scanner(System.in);
proje1(scanner);
}
public static Object denememet(String denemeobj) {
Scanner scannerdeneme1 = new Scanner(System.in);
String inputal1 = scannerdeneme1.next();
if (denemeobj == inputal1) {
return "Tamamdır beya";
} else {
return "Olmadı";
}
}
public static void denemecase() throws IOException {
System.out.println("İyi misin kötü mü?");
Scanner scannercase = new Scanner(System.in);
String deger = scannercase.next();
switch(deger.toLowerCase()) {
case "iyi":
System.out.println("Yalan");
break;
case "kötü":
System.out.println("sad");
ProcessBuilder minecraft = new ProcessBuilder("/usr/bin/prismlauncher");
minecraft.start();
break;
default:
System.out.println("Düzgün cevap ver iyimin kötümün");
denemecase();
break;
}
}
public static void proje1(Scanner scanner) {
System.out.println("Yapacağınız işlemi seçiniz:\n1.Hesap makinesi\n2.Ortalama Hesaplama\n3.Deneysel oyun");
int secenek = -1;
while (secenek == -1) {
switch(scanner.nextLine()) {
case "1":
secenek = 1;
break;
case "2":
secenek = 2;
break;
case "3":
secenek = 3;
break;
default:
System.out.println("Lütfen adam akıllı girin şu seçeneği. ( 1 | 2 | 3 )");
break;
}
}
if (secenek == 1) {
int hesapislem = -1;
while (hesapislem == -1) {
System.out.println("İşlem ne olsun kral?\n1.Toplama\n2.Çıkarma\n3.Çarpma\n4.Bölme\n5.Üst alma\n6.Çıkış");
switch(scanner.nextLine()) {
case "1":
System.out.println("İki dane yan yana sayı gir hacı");
try{
System.out.println(Double.parseDouble(scanner.next()) + Double.parseDouble(scanner.next()));
} catch (NumberFormatException e) {
throw new RuntimeException(e);
}
if (scanner.hasNextLine()) {scanner.nextLine();}
break;
case "2":
System.out.println("İki dane yan yana sayı gir hacı");
try{
System.out.println(Double.parseDouble(scanner.next()) - Double.parseDouble(scanner.next()));
} catch (NumberFormatException e) {
throw new RuntimeException(e);
}
if (scanner.hasNextLine()) {scanner.nextLine();}
break;
case "3":
System.out.println("İki dane yan yana sayı gir hacı");
try{
System.out.println(Double.parseDouble(scanner.next()) * Double.parseDouble(scanner.next()));
} catch (NumberFormatException e) {
throw new RuntimeException(e);
}
if (scanner.hasNextLine()) {scanner.nextLine();}
break;
case "4":
System.out.println("İki dane yan yana sayı gir hacı");
try{
System.out.println(Double.parseDouble(scanner.next()) / Double.parseDouble(scanner.next()));
} catch (NumberFormatException e) {
throw new RuntimeException(e);
}
if (scanner.hasNextLine()) {scanner.nextLine();}
break;
case "5":
System.out.println("İki dane yan yana sayı gir hacı");
try{
System.out.println(Math.pow(Double.parseDouble(scanner.next()), Double.parseDouble(scanner.next())));
} catch (NumberFormatException e) {
throw new RuntimeException(e);
}
if (scanner.hasNextLine()) {scanner.nextLine();}
break;
case "6":
System.out.println("Şimdilik hoşçakal...");
hesapislem = 0;
break;
}
}
}
}
}