is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
1.- I have created two classes, one for receiving the scores after every game. the second contains the main class and the process flow for starting the tournament and scoring after every game.
- hrmnn2005 April 21, 2018{}
package premierleagueplayers;
/**
*
* @author hrmnn
*/
public class PlayerScore{
int idPlayer;
int score;
public PlayerScore(int idPlayer, int score ){
this.idPlayer=idPlayer;
this.score=score;
}
}
package premierleagueplayers;
import java.util.*;
import javafx.util.Pair;
/**
*
* @author hrmnn
*/
public class PremierLeaguePlayers {
int numberOfPlayers;
int numberOfGames;
Map<Integer,Integer> scores;
public PremierLeaguePlayers(){
this.scores=new HashMap<Integer, Integer>();
}
/**
*
*/
public void printScore(){
System.out.println("Printing Score");
for(Integer id:this.scores.keySet()){
int key=id.intValue();
int value=this.scores.get(id).intValue();
System.out.println(key + "=" +value);
}
}
public void startTournament(int players, int games){
this.numberOfGames=games;
this.numberOfPlayers=players;
System.out.println("starting tournament");
for(int i=1;i<=this.numberOfPlayers;i++){
this.scores.put(i, 0);
}
}
private void updatingScores(PlayerScore[] args){
int playerValue;
for(int i=0;i<args.length;i++){
playerValue=this.scores.get(args[i].idPlayer);
this.scores.replace(args[i].idPlayer, args[i].score+playerValue);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
PremierLeaguePlayers rankings= new PremierLeaguePlayers();
rankings.startTournament(10,10);
rankings.printScore();
System.out.println("Scores after first game");
PlayerScore[] score1= new PlayerScore[10];
score1[0]=new PlayerScore(1,3);
score1[1]=new PlayerScore(2,4);
score1[2]=new PlayerScore(3,10);
score1[3]=new PlayerScore(4,1);
score1[4]=new PlayerScore(5,0);
score1[5]=new PlayerScore(6,5);
score1[6]=new PlayerScore(7,2);
score1[7]=new PlayerScore(8,7);
score1[8]=new PlayerScore(9,2);
score1[9]=new PlayerScore(10,1);
rankings.updatingScores( score1);
rankings.printScore();
System.out.println("Scores after second game");
score1[0]=new PlayerScore(1,3);
score1[1]=new PlayerScore(2,4);
score1[2]=new PlayerScore(3,3);
score1[3]=new PlayerScore(4,1);
score1[4]=new PlayerScore(5,4);
score1[5]=new PlayerScore(6,5);
score1[6]=new PlayerScore(7,2);
score1[7]=new PlayerScore(8,7);
score1[8]=new PlayerScore(9,2);
score1[9]=new PlayerScore(10,10);
rankings.updatingScores( score1);
rankings.printScore();
}
}