Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Im trying to get the rank to be different depending on their score but all its saying is level 1 for each rank. It should
Im trying to get the rank to be different depending on their score but all its saying is "level 1" for each rank. It should have a rank 1-4 depending on the players score . any help ? java
Player:Sam Score: 60 Rank: Level 1 Player:Mary Score: 46 Rank: Level 1 Player:Sue Score:49 Rank: Level 1 Game Ended.. The winner is: Player:Joe Score: 61 Rank:Level 1 Game has started Player:ben Score:55 Rank: Level 1 Player:jake Score: 65 Rank:Level 1 Player: rose Score: 45 Rank: Level 1 Player: mike Score:41 Rank: Level 1 Game Ended... The winner is: Player:jake Score: 65 Rank:Level 1 9 1 package CHPP; 2 3 public class gameDriver { 40 public static void main(String[] args) { 5 Player() player = new Player [4]; 6 player [0] = new Player("Joe"); 7 player[1] = new Player("Sam"); 8 player (2] = new Player("Mary"); player (3) = new Player("Sue"); 10 11 Game game = new Game(player); 12 game.start(); 13 game.end(); 14 Player winner = game, decideWinner(); 15 System.out.println("The winner is: " + winner); 16 17 Player() s1 = new Player [4]; 18 s1[0] = new Player("ben"); 19 s1[1] = new Player("jake"); 20 51[2] = new Player("rose"); 21 s1[3] new Player("mike"); 22 23 Game game1 = new Game(s1); 24 game1.start(); 25 gamel.end(); 26 Player winner1 = game1.decideWinner(); 27 System.out.println("The winner is: " + winneri); 28 29 30 31 32 33 34 1 Player.java X Game.java gameDriver.java 47e public void play() 48 { 49 int loopPick = (int) ((Math.random() * (10 - 5)) + 5); 58 while(loopPick 10) 51 { 52 loopPick = (int) ((Math.random() * (10 - 5)) + 5); 53 } 54 55 for(int i = 0; i 10) 59 60 pick = (int) ((Math.random() * (10 - 5)) + 5); 61 62 setScore(getScore() + pick); 63 64 } public String decideRank() { String r = ""; if (getScore() >= 50) r = "Level 1"; else if (getScore() >= 35 && getScore() = 20 && getScore() 10) LoopPick = (int) ((Math.random() = (10 - 5)) + 5); } for(int i = 0; i 10) { pick = (int) ((Math.random() * (10 - 5)) + 5); 3 setScore(getScore() + pick); } 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