Last active
October 27, 2020 03:42
-
-
Save RakibOFC/d69ef12057218d281c8d696e7e1841e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package facebook; | |
import java.util.Scanner; | |
import java.util.Random; | |
package facebook; | |
class Facebook { | |
String name; | |
int age, friends; | |
} | |
public class Main { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
Facebook oj1 = new Facebook(); | |
Facebook oj2 = new Facebook(); | |
Facebook oj3 = new Facebook(); | |
Facebook oj4 = new Facebook(); | |
Facebook oj5 = new Facebook(); | |
Random ob = new Random(); | |
///Object 1 | |
System.out.println("Enter Name: "); | |
oj1.name = input.nextLine(); | |
System.out.println("Enter Age: "); | |
oj1.age = input.nextInt(); | |
System.out.println("Information for Object 1:"); | |
System.out.println("Name: " + oj1.name); | |
System.out.println("Age: " + oj1.age); | |
System.out.println("Friends: " + ob.nextInt() % 500); | |
///Object 2 | |
System.out.println("Enter Name: "); | |
oj2.name = input.nextLine(); | |
System.out.println("Enter Age: "); | |
oj2.age = input.nextInt(); | |
System.out.println("Information for Object 2:"); | |
System.out.println("Name: " + oj2.name); | |
System.out.println("Age: " + oj2.age); | |
System.out.println("Friends: " + ob.nextInt() % 500); | |
///Object 3 | |
System.out.println("Enter Name: "); | |
oj3.name = input.nextLine(); | |
System.out.println("Enter Age: "); | |
oj3.age = input.nextInt(); | |
System.out.println("Information for Object 2:"); | |
System.out.println("Name: " + oj3.name); | |
System.out.println("Age: " + oj3.age); | |
System.out.println("Friends: " + ob.nextInt() % 500); | |
///Object 4 | |
System.out.println("Enter Name: "); | |
oj4.name = input.nextLine(); | |
System.out.println("Enter Age: "); | |
oj4.age = input.nextInt(); | |
System.out.println("Information for Object 2:"); | |
System.out.println("Name: " + oj4.name); | |
System.out.println("Age: " + oj4.age); | |
System.out.println("Friends: " + ob.nextInt() % 500); | |
///Object 5 | |
System.out.println("Enter Name: "); | |
oj5.name = input.nextLine(); | |
System.out.println("Enter Age: "); | |
oj5.age = input.nextInt(); | |
System.out.println("Information for Object 2:"); | |
System.out.println("Name: " + oj5.name); | |
System.out.println("Age: " + oj5.age); | |
System.out.println("Friends: " + ob.nextInt() % 500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment