Import java awt.*; import java sql. Savepoint


Download 14.83 Kb.
Sana28.12.2022
Hajmi14.83 Kb.
#1022958
Bog'liq
usmonjonnnnnnnnnn


import java.awt.*;
import java.sql.Savepoint;
import java.util.Random;
import java.util.Scanner;
import java.util.*;
/**
* Created by Abdulaminxon on 03/01 2018.
* WebDastur.Uz
* Type: Game
* Version: 1.0
*/
public class Main {
public static void main(String args[]){
Scanner kirit = new Scanner(System.in);
Random ixti = new Random();
int komp,foyda,narx,sovga,javob,bnarx,yutqazmoq;
String ism;


System.out.println("Salom siz omadlar o'yiniga hush kelibsiz!");
System.out.println("Ismingizni kiriting: ");
ism = kirit.next();
System.out.println(ism + " o'yinga tayyormisiz!");
System.out.println("Tayyor bo'lsangiz '1' Tayyor bo'lmasangiz '2' deb javob bering");
javob = kirit.nextInt();
// Boshlanish
metka:
if (javob == 1){
System.out.println("Kiritiladigan summani kiriting: ");
narx = kirit.nextInt();
bnarx = ixti.nextInt(narx); // komp o'ylagan narx
System.out.println("Siz kiritgan summa: " + narx + "\nBotimmiz kiritgan summa: " + bnarx);
System.out.println("Endi boshladik '0' dan '5' gacha son o'ylab yozing.\nAgar kiritgan soningiz botimmiz o'ylagan son bilan teng bo'lsa\nSiz botning 50 % pulini olasiz!");
foyda = kirit.nextInt();
if (foyda>5 || foyda<0) {
System.out.println("Siz noto'g'ri son kiritdingiz qayta kiriting!");
foyda = kirit.nextInt();


}
komp = ixti.nextInt(6);
if (komp == foyda){
sovga = (bnarx/100)*50;
System.out.println("Siz yutdingiz olgan mablag'ingiz: "+sovga);
narx+=sovga;
System.out.printf("Umumiy pulingiz: %d",narx);


}else {
sovga = (narx/100)*50;
System.out.printf("Siz yutqazdingiz. Yutqazgan summangiz %d shunga teng!", sovga);


}


}}
}
Download 14.83 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling