-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomer.java
More file actions
49 lines (38 loc) · 1.29 KB
/
customer.java
File metadata and controls
49 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
class Customer {
String name;
String cellNumber;
String pkg;
int age;
public void getData() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter customer name: ");
name = scanner.nextLine();
System.out.print("Enter customer cell number: ");
cellNumber = scanner.nextLine();
System.out.print("Enter customer package: ");
pkg = scanner.nextLine();
System.out.print("Enter customer age: ");
age = scanner.nextInt();
}
public void displayData() {
System.out.println("Customer Name: " + name);
System.out.println("Customer Cell Number: " + cellNumber);
System.out.println("Customer Package: " + pkg);
System.out.println("Customer Age: " + age);
}
}
class CustomerInfo {
public static void main(String[] args) {
Customer[] customers = new Customer[3];
for (int i = 0; i < customers.length; i++) {
customers[i] = new Customer();
customers[i].getData();
}
System.out.println("\nCustomer Details:");
for (Customer customer : customers) {
customer.displayData();
System.out.println();
}
}
}