Question
Imagine that two basketball teams, Mavericks and Warriors, play in the Championship games this year. They will play 7 games. Write a Java program that
Imagine that two basketball teams, Mavericks and Warriors, play in the Championship games this year. They will play 7 games. Write a Java program that can store the imagined scores of each team at the end of each game of the all 7 games. The program reads the scores of each team from the console and stored them in arrays. At the end, the program displays (to the console) the result of each game. Make sure that if a team win 4 games, then the Championship games end (the team with 4 wins becomes the champion).
Sample of the input:
Game1 Mavericks 90 Warriors 89
Game2 Mavericks 101 Warriors 120
Game3 Mavericks 112 Warriors 100
Game4 Mavericks 102 Warriors 100
Game5 Mavericks 108 Warriors 105
Game6 Mavericks 111 Warriors 130
Game7 Mavericks 100 Warriors 102
Sample of the output:
Game 1: Mavericks wins.
Game 2: Warriors wins.
Game 3: Mavericks wins.
Game 4: Mavericks wins.
Game 5: Mavericks wins. Mavericks wins the championship!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started