-
Notifications
You must be signed in to change notification settings - Fork 0
/
Product_customer.java
112 lines (68 loc) · 1.49 KB
/
Product_customer.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
class product
{
private String item_no;
private String name;
private double price;
private short qty;
public void setQty(short qty)
{
qty = qty;
}
public void setPrice(double price)
{
price = price;
}
public product(String item_no ,String name)
{
this.item_no = item_no;
this.name = name;
}
public product(String item_no,String name,double price, short qty)
{
item_no = item_no;
name = name;
price = price;
qty = qty;
setPrice(price);
setQty(qty);
}
public String getItem_no(){return item_no;}
public double getPrice() {return price;}
public String getName(){return name;}
public short getQty(){return qty;}
}
class customer
{
private String cid;
private String name;
private String phone_no;
private String address;
public void setPhoneno(String phone_no){phone_no = phone_no;}
public void setAddress(String add){add = address;}
public customer(String cid,String name)
{
this.cid = cid;
this.name = name;
}
public customer(String cid,String name,String add,String phone)
{
this.cid = cid;
this.name = name;
setPhoneno(add);
setAddress(phone);
}
public String getCid(){return cid;}
public String getName(){return name;}
public String getPhone_no(){return phone_no;}
public String address(){return address;}
}
class Product_customer
{
public static void main(String [] args)
{
product p = new product("A1","Milk");
customer c = new customer("C001","alpha");
System.out.println(p.getItem_no()+" "+p.getName());
System.out.println(c.getCid()+" "+c.getName());
}
}