/***Anabstractclassthatiscommontoseveralgamesin*whichplayersplayagainsttheothers,butonlyoneis*playingatagiventime.*/abstractclassGame{privateintplayersCount;abstractvoidinitializeGame();abstractvoidmakePlay(intplayer);abstractbooleanendOfGame();abstractvoidprintWinner();/*Atemplatemethod:*/finalvoidplayOneGame(intplayersCount){this.playersCount=playersCount;initializeGame();intj=0;while(!endOfGame()){makePlay(j);j=(j 1)%playersCount;}printWinner();}}//Nowwecanextendthisclassinordertoimplementactualgames:classMonopolyextendsGame{/*Implementationofnecessaryconcretemethods*/voidinitializeGame(){//...}voidmakePlay(intplayer){//...}booleanendOfGame(){//...}voidprintWinner(){//...}/*SpecificdeclarationsfortheMonopolygame.*///...}classChessextendsGame{/*Implementationofnecessaryconcretemethods*/voidinitializeGame(){//...}voidmakePlay(intplayer){//...}booleanendOfGame(){//...}voidprintWinner(){//...}/*Specificdeclarationsforthechessgame.*///...}publicclassPlayer{publicstaticvoidmain(String[]args){GamechessGame=newChess();chessGame.initializeGame();chessGame.playOneGame(1);//calltemplatemethod}}