Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.33 KB | None | 0 0
  1.  
  2. public class BasketballGame {
  3.  
  4.     public static void main(String[] args) {
  5.         // TODO Auto-generated method stub
  6. int torontopoints[];
  7.         ball();
  8. torontopoints();
  9.     torontopoints=totaltoronto(six);
  10.     }
  11.  
  12.    
  13.    
  14.    
  15.    
  16.    
  17.    
  18.    
  19.     private static void ball(){
  20.         String[] toronto={"Kyle Lowry #7","Demar Derozan #10","Demarre Caroll #5", "Serge Ibaka #9","Jonas Valucianus #17"};
  21.         String[] golden={"Stephen Curry #30","Klay Thompson #11", "Kevin Durant #35","Draymond Green #23","Zaza Pachulia #27"};
  22.         System.out.println("Welcome to the NBA 2017 Finals");
  23.         System.out.println("Golden State Warriors vs. Toronto Raptors:");
  24.         System.out.println("Here Are Your Starting Lineups:");
  25.         System.out.println();
  26.         System.out.println("Toronto Raptors:");
  27.  
  28.         for(int i=0;i<toronto.length;i++){
  29.             System.out.println(toronto[i]);
  30.         }
  31.         System.out.println();
  32.         System.out.println("Golden State Warriors:");
  33.         for(int i=0;i<toronto.length;i++){
  34.             System.out.println(golden[i]);
  35.         }  
  36.    
  37.     }
  38. private static int[] torontopoints(){
  39.     int randomraps;
  40.     int randomplayer;
  41.     int[] six;
  42.     six=new int[5];
  43.     String[] toronto={"Kyle Lowry #7","Demar Derozan #10","Demarre Caroll #5", "Serge Ibaka #9","Jonas Valucianus #17"};
  44.    
  45.     randomraps=(int) (Math.random()*4+1);
  46.     randomplayer=(int)(Math.random()*4+1);
  47.     if(randomraps==1){
  48.     System.out.print("Foul on:");
  49.     System.out.print( toronto[randomplayer]);
  50.         }
  51.     if(randomraps==2){
  52.         System.out.println("2-Pointer Made by:");
  53.         System.out.print(toronto[randomplayer]);
  54.         six[randomplayer]=+2;
  55.     }
  56.     if(randomraps==3){
  57.         System.out.println("3-Pointer Made By:");
  58.         System.out.print(toronto[randomplayer]);
  59.         six[randomplayer]=+3;
  60.     }
  61.     if(randomraps==4){
  62.         int foulshots;
  63.         foulshots=(int) (Math.random()*2+1);
  64.         System.out.println("Shooting Foul Shots:");
  65.         System.out.println(toronto[randomplayer]);
  66.         if(foulshots==1){
  67.                
  68.                 System.out.println("2-of-2 FT Made");
  69.                 six[randomplayer]=+2;
  70.         }
  71.         if(foulshots==2){
  72.             System.out.println("1-of-2 FT Made");
  73.             six[randomplayer]=+1;
  74.         }
  75.         if(foulshots==3){
  76.             System.out.println("0-2 FT Made");
  77.         }
  78.     }
  79.    
  80.    
  81.     return six;
  82.             }
  83.  
  84.    
  85.     private static int totaltoronto(int[]six){
  86.         int totaltoronto = 0;
  87.        
  88.        
  89.         for(int i=0;i<six.length;i++){
  90.             totaltoronto=totaltoronto+six[i];
  91.         }
  92.         System.out.println(totaltoronto);
  93.         return totaltoronto;
  94.         }
  95.    
  96.    
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement