I have an array with 3 players and an other array with several powers.
String[] array_Player = {"Celine", "Amelia", "Olivia"};
int[] array_power_1 = {4,2,10};
The player who has the smallest "power" will have 2 points, the best will have 6 pts.
I would like to get this result:
Celine | power 4 => points 4
Amelia | power 2 => points 2
Olivia | power 10 => points 6
Here is my resultat for now:
Celine | power 4 => points 2
Amelia | power 2 => points 4
Olivia | power 10 => points 6
My points are not correctly attributed.
I think my array_point_power() method is not correct?
public static void array_point_power(String[] array_Player, int[] array_point){
int points = 2;
for(int i=0; i<array_Player.length; i++){
array_point[i] = points;
points = points + 2;
}
}
Here is my code:
import java.util.*;
class Main {
public static void main(String[] args) {
String[] array_Player = {"Celine", "Amelia", "Olivia"};
int[] array_power_1 = {4,2,10};
int[] array_point_1 = new int[3];
System.out.println("Round 1 : ");
array_point_power(array_Player, array_point_1);
affichage_round(array_Player, array_power_1, array_point_1);
}
public static void array_point_power(String[] array_Player, int[] array_point){
int points = 2;
for(int i=0; i<array_Player.length; i++){
array_point[i] = points;
points = points + 2;
}
}
public static void affichage_round(String[] array_Player, int[] array_power, int[] array_point) {
for(int i=0; i<array_Player.length; i++){
System.out.println("Joueur " + array_Player[i] + " | Puissances " + array_power[i] + " | Points " + array_point[i] );
}
}
}
Thank you for your help.