-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.java
More file actions
23 lines (20 loc) · 894 Bytes
/
Copy pathDirectory.java
File metadata and controls
23 lines (20 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import javax.swing.JOptionPane;
public class Directory {
public static void main(String[] args) {
String[] names = new String[5];
String[] phoneNumbers = new String[5];
String[] addresses = new String[5];
for (int i = 0; i < 5; i++) {
names[i] = JOptionPane.showInputDialog("Enter Name " + (i + 1) + ":");
phoneNumbers[i] = JOptionPane.showInputDialog("Enter Telephone Number " + (i + 1) + ":");
addresses[i] = JOptionPane.showInputDialog("Enter Address " + (i + 1) + ":");
}
String directory = "";
for (int i = 0; i < 5; i++) {
directory += "Name: " + names[i] + "\n";
directory += "Telephone No.: " + phoneNumbers[i] + "\n";
directory += "Address: " + addresses[i] + "\n\n";
}
JOptionPane.showMessageDialog(null, directory);
}
}