Blonk

Untitled

Mar 2nd, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.*;
  3. import java.util.concurrent.ThreadLocalRandom;
  4. import java.util.Scanner;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.         Scanner keyboard = new Scanner(System.in);
  11.  
  12.         String n1[] = {"Andrea", "Caicedo", "Camilo", "Filippa", "Samuel"};
  13.         double ga2[] = {99.5, 78.5, 95.6, 96.8, 82.7};
  14.         int c3[] = {123456, 813225, 823669, 307760, 827131};
  15.         int slot = 0;
  16.         boolean found = false;
  17.         String name = "";
  18.         double  average = 0.00;
  19.         int id = 0;
  20.  
  21.  
  22.         System.out.println("Values: ");
  23.         System.out.println(n1[0] +" " + ga2[0] + " " + c3[0]);
  24.         System.out.println(n1[1] +" " + ga2[1] + " " + c3[1]);
  25.         System.out.println(n1[2] +" " + ga2[2] + " " + c3[2]);
  26.         System.out.println(n1[3] +" " + ga2[3] + " " + c3[3]);
  27.         System.out.println(n1[4] +" " + ga2[4] + " " + c3[4]);
  28.  
  29.         System.out.println();
  30.         System.out.println("ID number to find");
  31.         int id_Numbers = keyboard.nextInt();
  32.  
  33.         for (int i = 0; i < c3.length; i++){
  34.             if (c3[i] == id_Numbers && !found){
  35.                 slot = i;
  36.                 name = n1[i];
  37.                 average = ga2[i];
  38.                 id = c3[i];
  39.                 found = true;
  40.             }
  41.         }
  42.         System.out.print("Found in the slot " + slot);
  43.         System.out.println();
  44.         System.out.println("Name: " + name);
  45.         System.out.println("Average " + average);
  46.         System.out.println("ID: " + id);
  47.     }
  48. }
Add Comment
Please, Sign In to add comment