Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package uf1_activitat_14_5;
- import java.util.Arrays;
- import java.util.Random;
- /**
- *
- * @author nixie
- */
- public class UF1_activitat_14_5 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // \u2587 \u2586
- /*Generar una llista aleatòria de 100 elements compresos entre 30 i 50 que simuli el
- pes d’una sèrie de nens.*/
- Random random = new Random();
- int[] pes = new int[100];
- int index = 0;
- System.out.println("Pes:\tNombre de persones:");
- for (int i = 30; i <= 50; i++) {
- System.out.println(i);
- while (index < pes.length) {
- pes[index] = random.nextInt(20);
- pes[index] += 30;
- if (pes[index] == i) {
- Arrays.fill(pes, '\u2586');
- System.out.println(Arrays.toString(pes));
- }
- index++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement