-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSc2310_NBA.java
More file actions
58 lines (39 loc) · 1.59 KB
/
CSc2310_NBA.java
File metadata and controls
58 lines (39 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//Stephanie Wyckoff
//7/10/2016
//NBA
//Client program for NBATeam Class. User creates/names teams, adds players to teams and then plays a series of games.
import java.util.Scanner;
public class NBA {
public static void main(String[] args){
Scanner input = new Scanner (System.in);
String ifAddPlayer;
String playerName;
//construct Team Heat
System.out.println("Create the NBA team of Heat ...... ");
NBATeam heat= new NBATeam("Heat");
System.out.print("Add a player to Heat? (yes/no): ");
ifAddPlayer= input.next();
while (ifAddPlayer.equalsIgnoreCase("yes")){
System.out.print("What is the name to be added? ");
playerName=input.next();
heat.addAPlayer(playerName);
System.out.print("Add one more play to Heat? (yes/no): ");
ifAddPlayer= input.next();
}
//construct Team spurs
System.out.println("\nCreate the NBA team of Spurs ...... ");
NBATeam spurs= new NBATeam("Spurs");
System.out.print("Add a player to Spurs? (yes/no): ");
ifAddPlayer= input.next();
while (ifAddPlayer.equalsIgnoreCase("yes")){
System.out.print("What is the name to be added? ");
playerName=input.next();
spurs.addAPlayer(playerName);
System.out.print("Add one more play to Spurs? (yes/no): ");
ifAddPlayer= input.next();
}
heat.playGame(heat, spurs);
System.out.println(heat.getTeamName() + heat.getPlayerList() + " Win# " + heat.getWins() + " Lose# " + heat.getLoss());
System.out.println(spurs.getTeamName() + spurs.getPlayerList() + " Win# " + spurs.getWins() + " Lose# " + spurs.getLoss());
}
}