Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.*;
- import java.util.concurrent.ThreadLocalRandom;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- String n1[] = {"Andrea", "Caicedo", "Camilo", "Filippa", "Samuel"};
- double ga2[] = {99.5, 78.5, 95.6, 96.8, 82.7};
- int c3[] = {123456, 813225, 823669, 307760, 827131};
- int slot = 0;
- boolean found = false;
- String name = "";
- double average = 0.00;
- int id = 0;
- System.out.println("Values: ");
- System.out.println(n1[0] +" " + ga2[0] + " " + c3[0]);
- System.out.println(n1[1] +" " + ga2[1] + " " + c3[1]);
- System.out.println(n1[2] +" " + ga2[2] + " " + c3[2]);
- System.out.println(n1[3] +" " + ga2[3] + " " + c3[3]);
- System.out.println(n1[4] +" " + ga2[4] + " " + c3[4]);
- System.out.println();
- System.out.println("ID number to find");
- int id_Numbers = keyboard.nextInt();
- for (int i = 0; i < c3.length; i++){
- if (c3[i] == id_Numbers && !found){
- slot = i;
- name = n1[i];
- average = ga2[i];
- id = c3[i];
- found = true;
- }
- }
- System.out.print("Found in the slot " + slot);
- System.out.println();
- System.out.println("Name: " + name);
- System.out.println("Average " + average);
- System.out.println("ID: " + id);
- }
- }
Add Comment
Please, Sign In to add comment