-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGLProject.java
74 lines (53 loc) · 2.47 KB
/
GLProject.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
/*
* 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 GLProject {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Create a Client
Client client = new Client(1, "Alice", "[email protected]", "1234567890", "password123");
client.register("Alice", "[email protected]", "1234567890", "password123");
client.login("[email protected]", "password123");
// Create a Produit
Produit produit = new Produit(101, "Laptop", 1500.0f, "High-performance laptop", 10, "Electronics", "Computers", "image.jpg");
produit.getProductDetails();
Produit produit2 = new Produit(102, "Smartphone", 700.0f, "Latest model smartphone", 20, "Electronics", "Mobile", "smartphone.jpg");
produit2.getProductDetails();
// initial likes
System.out.println("Likes: " + produit.getLikes());
// increasing likes
produit.increaseLikes();
produit.increaseLikes();
System.out.println("Likes : " + produit.getLikes());
// decreasing likes
produit.decreaseLikes();
System.out.println("Likes : " + produit.getLikes());
// Crée un Panier
client.ajouterAuPanier(produit, 2); // Add 2 Laptops
client.ajouterAuPanier(produit2, 1); // Add 1 Smartphone
client.getPanier().afficherPanier();
//Total Price
System.out.println("Total Price in Cart: " + client.getPanier().getTotalPrice());
// Remove product from chart
client.supprimerDuPanier(produit, 1);
client.getPanier().afficherPanier();
// Place an order
Commande commande = new Commande(1, client.getIdUtilisateur(), client.getPanier().getCartItems(), "2025-01-03", "Pending");
commande.approveCommande();
// Cancel the order
commande.cancelCommande();
// Create an Administrateur (Admin)
Administrateur admin = new Administrateur(2, "Bob", "[email protected]", "0987654321", "admin123");
client.sendMessage("hey how is my oorder?");
admin.replyToMessage(client, "thank you for contacting we will see what we can do");
}
}