-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproducts.java
More file actions
40 lines (32 loc) · 859 Bytes
/
products.java
File metadata and controls
40 lines (32 loc) · 859 Bytes
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
package project.pkg151;
public class products {
private final String name;
private int ID;
private static int count_product=0;
private double price;
public products(String name,double price) {
this.name=name;
this.price=price;
ID+=++count_product;
}
//default constructor
public products() {
this.name=null;
}
public final int returnID(){
return this.ID;
}
public final String getName() {
return name;
}
public final double returnPrice(){
return this.price;
}
public void setPrice(double price) {
this.price = price;
}
@Override
public String toString() {
return "("+ID+")Products(" + "name: " + name + ", price: " + price + "SR )";
}
}