Computer Science, asked by janenisathyanarayan, 21 hours ago

Carrom ( java program )

If Cricket is the most popular outdoor game in India, Carrom is not too behind as one of most played indoor games.
Let's now make use of our knowlege in operators & conditional statements to compute the points scored at the end of a round in Carrom Game.

Carrom is a board game where two participants (teams) play. It consists of 9 white coins, 9 black coins and a red coin. The first team that finishes all their coins wins (given that red has been pocketed by one of the teams). The points are awarded based on the number of left-over coins of the opposition (loser) in the board. If the winning team has pocketed the red, they get an additional 5 points. Write a program to compute the score of winner at the end of a round.

If the number of coins left on the board is either less than 1 or greater than 9 display "Invalid Input".
Create a main class with the name "Main".

Input Format:
Input consists of a single integer which corresponds to number of coins left on board and a character which corresponds to whether the winning team has pocketed red or not.

Output Format:
Output corresponds to the total points won.
Print Invalid Input in case the no of coins is less than one or greater than nine.
[All text in bold corresponds to input and the rest corresponds to output]


Sample Input and Output 1:
Enter number of lost team's coins left on board
5
Has winning team pocketed red [y or n] ?
y
Points won : 10

Sample Input and Output 2:
Enter number of lost team's coins left on board
-1
Invalid Input

Answers

Answered by jigitsasachin
1

Answer:

 - 2

Explanation:

ok is your answer

Similar questions