Skip to content

qilingit/ASimpleTennisScoreComputer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

The scoring system consist in one game is divided by points :

Each player starts a game with 0 point.

  1. If the player wins the 1st ball, he will have 15 points. 2nd balls won : 30 points. 3rd ball won : 40points.
  2. If a player have 40 points and wins the ball, he wins the game, however there are special rules.
  3. If both players have 40 points the players are “deuce”.
  4. If the game is in deuce, the winner of the ball will have advantage
  5. If the player with advantage wins the ball he wins the game
  6. If the player without advantage wins the ball they are back at “deuce”.

We can find more details about the rules here : (http://en.wikipedia.org/wiki/Tennis#Scoring )

Here we want to develop a java method that will take a String as input containing the character ‘A’ or ‘B’. The character ‘A’ corresponding to “player A won the ball”, and ‘B’ corresponding to “player B won the ball”. The java method should print the score after each won ball (for example : “Player A : 15 / Player B : 30”) and print the winner of the game.

For example the following input “ABABAA” should print :

  • “Player A : 15 / Player B : 0”
  • “Player A : 15 / Player B : 15”
  • “Player A : 30 / Player B : 15”
  • “Player A : 30 / Player B : 30”
  • “Player A : 40 / Player B : 30”
  • “Player A wins the game

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages