serhatyucell

CS GO With exit sure

Nov 14th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. import java.util.Random;
  4.  
  5. public class CaseOpener {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.        
  10.        // Kroma 3 Kasası Şans Değerleri
  11.         String[] kroma3 = new String[100];
  12.         String[] kroma2 = new String[100];
  13.         String[] anka = new String[100];
  14.         String[] revolver = new String[100];
  15.         //%50
  16.         for (int i = 0; i < 50; i++) {
  17.             kroma3[i] = "Kroma 3 >> Iron Weapon";
  18.             kroma2[i] = "Kroma 2 >> Iron Weapon";
  19.             anka[i] = "Anka >> Iron Weapon";
  20.             revolver[i] = "Revolver >> Iron Weapon";
  21.            
  22.         }
  23.         //%25
  24.         for (int i = 50; i < 75; i++) {
  25.             kroma3[i] = "Kroma 3 >> Silver Weapon";
  26.             kroma2[i] = "Kroma 2 >> Silver Weapon";
  27.             anka[i] = "Anka >> Silver Weapon";
  28.             revolver[i] = "Revolver >> Silver Weapon";
  29.            
  30.         }
  31.         //%20
  32.         for (int i = 75; i < 95; i++) {
  33.             kroma3[i] = "Kroma 3 >> Gold Weapon";
  34.             kroma2[i] = "Kroma 2 >> Gold Weapon";
  35.             anka[i] = "Anka >> Gold Weapon";
  36.             revolver[i] = "Revolver >> Gold Weapon";
  37.            
  38.         }
  39.         //%5
  40.         for (int i = 95; i <= 99; i++) {
  41.             kroma3[i] = "Kroma 3 >> Titanium Weapon";
  42.             kroma2[i] = "Kroma 2 >> Titanium Weapon";
  43.             anka[i] = "Anka >> Titanium Weapon";
  44.             revolver[i] = "Revolver >> Titanium Weapon";
  45.            
  46.         }
  47.        
  48.         // Silahların Kalitesi
  49.        
  50.         String[] weaponQuality = new String[100];
  51.         //%30
  52.         for (int i = 0; i < 30; i++) {
  53.             weaponQuality[i] = " | Industrial Grade";
  54.            
  55.         }
  56.         //%30
  57.         for (int i = 30; i < 60; i++) {
  58.             weaponQuality[i] = " | Restricted";
  59.            
  60.         }
  61.         //%25
  62.         for (int i = 60; i < 85; i++) {
  63.             weaponQuality[i] = " | Classified";
  64.            
  65.         }
  66.         //%15
  67.         for (int i = 85; i < 99; i++) {
  68.             weaponQuality[i] = " | Special Edition";
  69.            
  70.         }
  71.  
  72.         // Kredi Sistemi
  73.        
  74.         Scanner creditInfo = new Scanner(System.in);
  75.         System.out.print("How much credits do you want? : ");
  76.         int credit = creditInfo.nextInt();
  77.            
  78.            
  79.             System.out.println("\n1-Kroma 3 | 2-Kroma 2 | 3-Anka Operasyon | 4-Revolver Case | 5-Exit");
  80.            
  81.             boolean finish = false;
  82.            
  83.             while(finish==false && credit!=0) {
  84.            
  85.                 for (int i = 0; i < credit; credit--) {
  86.                
  87.             Scanner s = new Scanner (System.in);    
  88.             System.out.print("\nYour Remaninig Credits: " + credit + "\nAçmak istediğiniz kutuyu seçin: ");
  89.             int kutu = s.nextInt();
  90.                
  91.             Random w = new Random();
  92.             int RandomWeapon = w.nextInt(100);
  93.             Random q = new Random();
  94.             int RandomWeaponQuality = q.nextInt(100);
  95.  
  96.            
  97.             if (kutu==1) {
  98.                 System.out.println("\n+You won new weapon: " + kroma3[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  99.             }
  100.            
  101.             else if (kutu==2) {
  102.                 System.out.println("\n+You won new weapon: " + kroma2[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  103.             }
  104.            
  105.             else if (kutu==3) {
  106.                 System.out.println("\n+You won new weapon: " + anka[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  107.             }
  108.            
  109.             else if (kutu==4) {
  110.                 System.out.println("\n+You won new weapon: " + revolver[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  111.             }
  112.            
  113.             else if (kutu==5) {
  114.                
  115.                 Scanner exit = new Scanner (System.in);
  116.                 System.out.println("Are you sure about the exit? [Y or N]:");
  117.                 char exit2 = exit.nextLine().charAt(0);
  118.                 if (exit2 == 'y' || exit2 == 'Y' ) {
  119.                     break;
  120.                 }
  121.                
  122.                 else {
  123.                     credit++;
  124.                     continue;
  125.  
  126.                 }
  127.             }
  128.            
  129.             else if (kutu>=6) {
  130.                 System.out.println("Please choose correct case number!");
  131.                 credit++;
  132.             }
  133.            
  134.                     }
  135.             finish=true;
  136.            
  137.            
  138.             }
  139.            
  140.             if (credit==0) {
  141.             System.out.println("\nYour credits is over!");
  142.             }
  143.            
  144.             else {
  145.                 System.out.println("\nYou closed the program!");
  146.             }
  147.        
  148.     }  
  149.    
  150. }
Advertisement
Add Comment
Please, Sign In to add comment