-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.java
More file actions
38 lines (37 loc) · 1.01 KB
/
Customer.java
File metadata and controls
38 lines (37 loc) · 1.01 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
import java.util.Scanner;
import java.util.StringTokenizer;
public class Customer {
String Name,date;
void read(){
Scanner sc=new Scanner(System.in);
Name=sc.next();
date=sc.next();
}
void display(){
System.out.println(Name+ " , ");
String s="/";
StringTokenizer st=new StringTokenizer(date,s);
while (st.hasMoreElements()){
if (st.countTokens()==1){
System.out.print(st.nextElement()+"");
break;
}
System.out.print(st.nextElement()+",");
}
System.out.println();
}
public static void main(String[] args) {
int n;
Scanner sc=new Scanner(System.in);
System.out.print("Enter number of Customer: ");
n=sc.nextInt();
Customer[] customer=new Customer[50];
for (int i=0;i<n;i++){
customer[i]=new Customer();
customer[i].read();
}
for (int i=0;i<n;i++){
customer[i].display();
}
}
}