Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My first Program #120

Open
Ilkin-Mammadov81 opened this issue Nov 24, 2024 · 0 comments
Open

My first Program #120

Ilkin-Mammadov81 opened this issue Nov 24, 2024 · 0 comments

Comments

@Ilkin-Mammadov81
Copy link

import java.util.Scanner;
import java.util.Random;
public class DasKagizQayci {
public static void main(String[]args) {
Scanner scan=new Scanner(System.in);
Random random=new Random();
String [] secimler={"Daş", "Kağız", "Qayçı"};
System.out.println(" Daş, Kağız, Qayçı oyununa xoş ğeldiniz !");
System.out.print("Oyuna başlamaq üçün bir eşya adı seçin(Daş, Kağız, Qayçı): ");
String istifadeciSecimi=scan.nextLine();
int komputerIndexSecimi=random.nextInt(3);
String
komputerSecimi=secimler[komputerIndexSecimi];
System.out.println(" Istifadeçi seçimi: "+istifadeciSecimi);
System.out.println(" Kompyuter seçimi: "+komputerSecimi);

if(istifadeciSecimi.equalsIgnoreCase(komputerSecimi)) {
System.out.println(" Oyun heç-heçe başa çatdı !");
} else if(istifadeciSecimi.equalsIgnoreCase("Daş") && komputerSecimi.equalsIgnoreCase("Qayçı")) {
System.out.println(" Qalib ğeldiniz! Daş qayçını sındırır.");
} else if(istifadeciSecimi.equalsIgnoreCase("Kağız") && komputerSecimi.equalsIgnoreCase("Daş")) {
System.out.println(" Qalib ğeldiniz! Kağız daşı bükür. ");
} else if(istifadeciSecimi.equalsIgnoreCase("Qayçı") && komputerSecimi.equalsIgnoreCase("Kağız")) {
System.out.println(" Qalib ğeldiniz! Qayçı kağızı kesir.");
} else {
System.out.println(" Meğlub oldunuz !");
return;
}
scan.close();
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant