Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BasketballGame {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int torontopoints[];
- ball();
- torontopoints();
- torontopoints=totaltoronto(six);
- }
- private static void ball(){
- String[] toronto={"Kyle Lowry #7","Demar Derozan #10","Demarre Caroll #5", "Serge Ibaka #9","Jonas Valucianus #17"};
- String[] golden={"Stephen Curry #30","Klay Thompson #11", "Kevin Durant #35","Draymond Green #23","Zaza Pachulia #27"};
- System.out.println("Welcome to the NBA 2017 Finals");
- System.out.println("Golden State Warriors vs. Toronto Raptors:");
- System.out.println("Here Are Your Starting Lineups:");
- System.out.println();
- System.out.println("Toronto Raptors:");
- for(int i=0;i<toronto.length;i++){
- System.out.println(toronto[i]);
- }
- System.out.println();
- System.out.println("Golden State Warriors:");
- for(int i=0;i<toronto.length;i++){
- System.out.println(golden[i]);
- }
- }
- private static int[] torontopoints(){
- int randomraps;
- int randomplayer;
- int[] six;
- six=new int[5];
- String[] toronto={"Kyle Lowry #7","Demar Derozan #10","Demarre Caroll #5", "Serge Ibaka #9","Jonas Valucianus #17"};
- randomraps=(int) (Math.random()*4+1);
- randomplayer=(int)(Math.random()*4+1);
- if(randomraps==1){
- System.out.print("Foul on:");
- System.out.print( toronto[randomplayer]);
- }
- if(randomraps==2){
- System.out.println("2-Pointer Made by:");
- System.out.print(toronto[randomplayer]);
- six[randomplayer]=+2;
- }
- if(randomraps==3){
- System.out.println("3-Pointer Made By:");
- System.out.print(toronto[randomplayer]);
- six[randomplayer]=+3;
- }
- if(randomraps==4){
- int foulshots;
- foulshots=(int) (Math.random()*2+1);
- System.out.println("Shooting Foul Shots:");
- System.out.println(toronto[randomplayer]);
- if(foulshots==1){
- System.out.println("2-of-2 FT Made");
- six[randomplayer]=+2;
- }
- if(foulshots==2){
- System.out.println("1-of-2 FT Made");
- six[randomplayer]=+1;
- }
- if(foulshots==3){
- System.out.println("0-2 FT Made");
- }
- }
- return six;
- }
- private static int totaltoronto(int[]six){
- int totaltoronto = 0;
- for(int i=0;i<six.length;i++){
- totaltoronto=totaltoronto+six[i];
- }
- System.out.println(totaltoronto);
- return totaltoronto;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement