-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathlab2b.java
46 lines (44 loc) · 1005 Bytes
/
lab2b.java
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
import java.util.Scanner;
import java.util.StringTokenizer;
class Customer
{
private String name;
private String date_of_birth;
public Customer(String name, String date_of_birth)
{
super();
this.name = name;
this.date_of_birth = date_of_birth;
}
public Customer ()
{
}
public void readData(String name, String date_of_birth)
{
this.name = name;
this.date_of_birth = date_of_birth;
}
public void displayData()
{
StringTokenizer st=new StringTokenizer(this.date_of_birth,"/");
System.out.print(this.name+",");
while(st.hasMoreTokens())
{
System.out.print(st.nextToken()+",");
}
}
}
public class lab2b
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
System.out.println("Enter Name :-");
String name=in.nextLine();
System.out.println("Enter Date of birth:-");
String date=in.next();
Customer customer=new Customer();
customer.readData(name, date);
customer.displayData();
}
}