Advertisement
An0n0ym0usHacker

Untitled

Feb 15th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.86 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Formatter;
  3.  
  4. public class party_friends
  5. {
  6.     public static void main(String arg[])
  7.     {
  8.         Scanner friends = new Scanner(System.in);
  9.         System.out.println("Enter the Numbers to take to a Party: ");
  10.         int total_Friends = friends.nextInt();
  11.  
  12.         String friends_Name[] = new String[total_Friends];
  13.         String friends_hobbies[] = new String[total_Friends];
  14.         int friends_age[] = new int[total_Friends];
  15.         for (int i = 0; i< friends_Name.length; i++)
  16.         {
  17.             Scanner input  = new Scanner(System.in);
  18.             System.out.println("\nEnter Your Friend's Name and Hobby(in that order) : ");
  19.             friends_Name[i] = input.nextLine();
  20.             friends_hobbies[i] = input.nextLine();
  21.  
  22.             //int friends_age[] = new int[total_Friends];
  23.             boolean is_Of_Age = false;
  24.             while(!is_Of_Age)
  25.             {
  26.                 Scanner Age = new Scanner(System.in);
  27.                 System.out.println("Enter Your Friend's Age: ");
  28.                 friends_age[i] = Age.nextInt();
  29.                 if(friends_age[i] >= 21)
  30.                 {
  31.                     is_Of_Age = true;
  32.                 }
  33.             }
  34.  
  35.  
  36.             //friend[i] = input.nextLine();
  37.             //System.out.println(friend[0]);
  38.  
  39.             //System.out.format("%1s%16s%10d", name , hobby, age);
  40.  
  41.             //System.out.println("Name " + name + "\nHobby: " + hobby + "\nAge: " + age);
  42.  
  43.         }
  44.         System.out.println("Index \tName \t\t\tHobby \t\tAge");
  45.         for(int i = 0; i < friends_Name.length; i++)
  46.         {
  47.             System.out.println(i +"\t\t"+ friends_Name[i] +"\t\t"+ friends_hobbies[i] +"\t\t"+ friends_age[i]);
  48.             //System.out.format("%1s%16s%10d" , friends_Name[i] +" "+ friends_hobbies[i] +" "+ friends_age[i]);
  49.         }
  50.  
  51.  
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement