This project is a simple Java-based order management system. It allows you to manage clients, products, and orders, and calculate the total invoice amount for a given order.
src/Client.java
: Defines theClient
class with attributesid
andnom
.src/LigneCommande.java
: Defines theLigneCommande
class with attributesproduit
,prix
, andquantite
.src/Main.java
: The main entry point of the application. It creates instances ofMetier
,Produit
,LigneCommande
, andClient
, and calculates the invoice for a sample order.src/Metier.java
: Implements theIMetier
interface, providing methods to manage orders and calculate invoices.
Represents a client with an ID and a name.
Represents a line item in an order, including the product, price, and quantity.
The main class that initializes the application and demonstrates its functionality.
Implements the business logic for managing clients, products, and orders.
- Clone the repository.
- Open the project in IntelliJ IDEA.
- Run the
Main
class to see the sample output.
The Main
class demonstrates how to create clients, products, and orders, and how to calculate the total invoice amount for an order.
public class Main {
public static void main(String[] args) {
// Create instance of Metier
Metier metier = new Metier();
// Create some products
Produit produit1 = new Produit(1, "Laptop", 1.0);
Produit produit2 = new Produit(2, "Smartphone", 00.0);
Produit produit3 = new Produit(3, "Headphones", 1.0);
LigneCommande lc1 = new LigneCommande(produit1, 1200, 10);
LigneCommande lc2 = new LigneCommande(produit2, 3200, 8);
LigneCommande lc3 = new LigneCommande(produit3, 200, 9);
Client c1 = new Client(1, "mehdi");
Client c2 = new Client(2, "omar");
Client c3 = new Client(3, "salah");
ArrayList<LigneCommande> al = new ArrayList<>();
al.add(lc1);
al.add(lc2);
al.add(lc3);
Commande cmd1 = new Commande(1, al, c1, "23-04-2005");
IMetier ts = new Metier();
System.out.println(ts.calculFacture(cmd1));
}
}