-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProduit.java
70 lines (59 loc) · 1.8 KB
/
Produit.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gl.project;
/**
*
* @author gh
*/
public class Produit {
private int idProduit;
private String name;
private float price;
private String description;
private int stock;
private String category;
private String subCategory;
private String images;
private int likes = 0;
public Produit(int idProduit, String name, float price, String description, int stock, String category, String subCategory, String images) {
this.idProduit = idProduit;
this.name = name;
this.price = price;
this.description = description;
this.stock = stock;
this.category = category;
this.subCategory = subCategory;
this.images = images;
}
public void getProductDetails() {
System.out.println("Product: " + name + ", Price: " + price + ", Likes: " + likes);
}
public void updateStock(int quantity) {
this.stock += quantity;
System.out.println("Stock updated. New stock: " + stock);
}
public void increaseLikes() {
likes++;
System.out.println(name + " received a like. Total likes: " + likes);
}
public void decreaseLikes() {
if (likes > 0) {
likes--;
System.out.println(name + " lost a like. Total likes: " + likes);
} else {
System.out.println(name + " has no likes to remove.");
}
}
public int getLikes() {
return likes;
}
public String getName() {
return name;
}
public float getPrice() {
return price;
}
}