From 848fddf68ff8b9263c942912908a0db3f3312a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 22:50:10 +0100 Subject: [PATCH 01/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 compteRendu.md diff --git a/compteRendu.md b/compteRendu.md new file mode 100644 index 0000000..40d9792 --- /dev/null +++ b/compteRendu.md @@ -0,0 +1,6 @@ +# Compte rendu de la SAE1.01 - Implémentation d'un besoins client. + +## Information sur les clients : + +- Numéro de client +- -- 2.36.3 From 476b51619f1bf6a317692b28fe6163c4acd9007c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:20:13 +0100 Subject: [PATCH 02/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/compteRendu.md b/compteRendu.md index 40d9792..5c845fb 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -1,6 +1,36 @@ -# Compte rendu de la SAE1.01 - Implémentation d'un besoins client. +# # Compte rendu de la SAE1.01 - Implémentation des besoins du client -## Information sur les clients : +## Informations sur les clients : - Numéro de client -- +- Solde du client +- Son état (suspension ou non) + +## Informations sur les articles : + +- Référence de l'article +- Poids de l'article +- Volume de l'article +- Prix unitaire de l'article + +## Fichiers de données : + +1. articles.txt : + - Référence, Poids, Volume, PrixUnitaire +2. clients.txt : + - Numéro de client, solde, suspension + +## Répartition du travail : + +**Mathéo** a conçu l'architecture du projet. La documentation a été rédigée par **Yannis** et **Mathéo**. + +Dans ce projet, nous avons réparti les tâches de la manière suivante : + +- **Mathéo** s'occupe principalement de la partie client +- **Yannis** est en charge principalement de la partie responsable. + +Cependant il est important de noter que nous avons collaboré sur les deux parties du projet. Chacun de nous a contribué aux deux parties. Vous pouvez identifier l'auteur des fonctions en fonction de leur style de codage : généralement, **Mathéo** place les accolades ouvrantes sur la même ligne que le prototype de la fonction etc. En revanche, **Yannis** a tendance à sauter une ligne après les prototypes et les structures de contrôle. + +## Comment démarrer l'application ? + +Pour démarrer l'application, nous vous recommandons d'utiliser le script `build.sh`. Ce script vous permet de compiler et de lancer l'application en utilisant l'option `-rb`. Vous n'avez pas besoin de compiler l'application manuellement ni d'exécuter l'exécutable vous-même. Exécutez simplement la commande `./build.sh -rb` pour que l'ensemble du processus soit automatisé. -- 2.36.3 From e459d5e33d8b4de59811de3c9a56823d82715e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:31:03 +0100 Subject: [PATCH 03/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compteRendu.md b/compteRendu.md index 5c845fb..d86f36e 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -29,8 +29,18 @@ Dans ce projet, nous avons réparti les tâches de la manière suivante : - **Mathéo** s'occupe principalement de la partie client - **Yannis** est en charge principalement de la partie responsable. -Cependant il est important de noter que nous avons collaboré sur les deux parties du projet. Chacun de nous a contribué aux deux parties. Vous pouvez identifier l'auteur des fonctions en fonction de leur style de codage : généralement, **Mathéo** place les accolades ouvrantes sur la même ligne que le prototype de la fonction etc. En revanche, **Yannis** a tendance à sauter une ligne après les prototypes et les structures de contrôle. +Cependant, il va sans dire que même avec une telle organisation nous avons tout de même collaboré sur les deux parties du projet. Chacun de nous a contribué aux deux parties. Vous pouvez identifier l'auteur des fonctions en fonction de leur style de codage : généralement, **Mathéo** place les accolades ouvrantes sur la même ligne que le prototype de la fonction etc. En revanche, **Yannis** a tendance à sauter une ligne après les prototypes et les structures de contrôle. ## Comment démarrer l'application ? Pour démarrer l'application, nous vous recommandons d'utiliser le script `build.sh`. Ce script vous permet de compiler et de lancer l'application en utilisant l'option `-rb`. Vous n'avez pas besoin de compiler l'application manuellement ni d'exécuter l'exécutable vous-même. Exécutez simplement la commande `./build.sh -rb` pour que l'ensemble du processus soit automatisé. + +## Conception + +### Architecture : + +L'architecture du projet a été pensée de sorte a séparer l'interface de l'application de la logique. + +## Pourquoi avons-nous fait ceci ? + +L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous pourrions concevoir une interface graphique ou une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. -- 2.36.3 From bf9e7df79307d4aa827ef1468eded025da76fc3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:31:51 +0100 Subject: [PATCH 04/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compteRendu.md b/compteRendu.md index d86f36e..fa57235 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -1,4 +1,4 @@ -# # Compte rendu de la SAE1.01 - Implémentation des besoins du client +# Compte rendu de la SAE1.01 - Implémentation des besoins du client ## Informations sur les clients : @@ -41,6 +41,6 @@ Pour démarrer l'application, nous vous recommandons d'utiliser le script `build L'architecture du projet a été pensée de sorte a séparer l'interface de l'application de la logique. -## Pourquoi avons-nous fait ceci ? +### Pourquoi avons-nous fait ceci ? L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous pourrions concevoir une interface graphique ou une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. -- 2.36.3 From f4f20c0558a181b9f5cdd395e16f3d2a6f77a29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:44:45 +0100 Subject: [PATCH 05/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compteRendu.md b/compteRendu.md index fa57235..c87804b 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -43,4 +43,4 @@ L'architecture du projet a été pensée de sorte a séparer l'interface de l'ap ### Pourquoi avons-nous fait ceci ? -L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous pourrions concevoir une interface graphique ou une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. +L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous avons ici conçus une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. -- 2.36.3 From 4ca946a7f1da55d8b7e1e05e002bf22579aea172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:46:27 +0100 Subject: [PATCH 06/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 1 + 1 file changed, 1 insertion(+) diff --git a/compteRendu.md b/compteRendu.md index c87804b..2f8051f 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -44,3 +44,4 @@ L'architecture du projet a été pensée de sorte a séparer l'interface de l'ap ### Pourquoi avons-nous fait ceci ? L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous avons ici conçus une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. +Mais nous avons, grâce a cette architecture aucun problème pour créer d'autre interface comme l'interface des responsable. -- 2.36.3 From 67841b6a4fc53178ec457bd419ce8bc4e9a8c019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:53:06 +0100 Subject: [PATCH 07/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 1 + 1 file changed, 1 insertion(+) diff --git a/compteRendu.md b/compteRendu.md index 2f8051f..4096b9a 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -34,6 +34,7 @@ Cependant, il va sans dire que même avec une telle organisation nous avons tout ## Comment démarrer l'application ? Pour démarrer l'application, nous vous recommandons d'utiliser le script `build.sh`. Ce script vous permet de compiler et de lancer l'application en utilisant l'option `-rb`. Vous n'avez pas besoin de compiler l'application manuellement ni d'exécuter l'exécutable vous-même. Exécutez simplement la commande `./build.sh -rb` pour que l'ensemble du processus soit automatisé. +Pour plus détail vous pouvez consulter le `README.md` afin d'y voir les différentes fonctionnalités. ## Conception -- 2.36.3 From 4a4d1b750f6c074b164e1f8d40ad78b3cea73d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Mon, 30 Oct 2023 23:56:00 +0100 Subject: [PATCH 08/12] start compte rendu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- compteRendu.md | 1 + 1 file changed, 1 insertion(+) diff --git a/compteRendu.md b/compteRendu.md index 4096b9a..591d6ee 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -46,3 +46,4 @@ L'architecture du projet a été pensée de sorte a séparer l'interface de l'ap L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous avons ici conçus une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. Mais nous avons, grâce a cette architecture aucun problème pour créer d'autre interface comme l'interface des responsable. +Un autre bénéfice majeur réside dans la facilité de maintenance. En segmentant le programme en couches et en composants distincts, nous avons la possibilité d'apporter des modifications à chacun d'eux sans altérer le code source des autres parties qui ne dépendent pas de ces modifications, préservant ainsi leur fonctionnement initial. -- 2.36.3 From d7d2dac0299505c44c3d3ff4e0cb35f3f9e6efb5 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Mon, 30 Oct 2023 23:56:35 +0100 Subject: [PATCH 09/12] Update 'compteRendu.md' --- compteRendu.md | 1 + 1 file changed, 1 insertion(+) diff --git a/compteRendu.md b/compteRendu.md index 591d6ee..a4d0a7d 100644 --- a/compteRendu.md +++ b/compteRendu.md @@ -46,4 +46,5 @@ L'architecture du projet a été pensée de sorte a séparer l'interface de l'ap L'adoption d'une telle architecture permet, comme précédemment expliqué, de démarquer l'interface du reste du programme. Cette approche facilite considérablement la création d'autres types d'interfaces en se concentrant exclusivement sur leur aspect visuel, tandis que la logique est encapsulée dans la couche "logique". Par exemple, nous avons ici conçus une interface orientée vers les adhérents, où ces derniers ont accès à des opérations spécifiques offertes par l'interface par défaut, mais limitées à leurs besoins. Mais nous avons, grâce a cette architecture aucun problème pour créer d'autre interface comme l'interface des responsable. + Un autre bénéfice majeur réside dans la facilité de maintenance. En segmentant le programme en couches et en composants distincts, nous avons la possibilité d'apporter des modifications à chacun d'eux sans altérer le code source des autres parties qui ne dépendent pas de ces modifications, préservant ainsi leur fonctionnement initial. -- 2.36.3 From 5d6ee0881d1e43f4a5db20da6eacb66f6fd172fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 15:51:49 +0100 Subject: [PATCH 10/12] better code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52176 -> 52400 bytes donnee/client.txt | 2 +- src/app/core_logic/client.c | 147 +++++++++++++++++---------- src/app/core_logic/client.h | 52 +++++++++- src/app/interface/interface_client.c | 25 +++-- src/app/interface/interface_client.h | 2 + 6 files changed, 156 insertions(+), 72 deletions(-) diff --git a/app b/app index 4ad0d038a63a4e0002f4fd0e6a7307d4e2336b8f..cfb49ba55316b08b2aaaab78651dae70c093f124 100755 GIT binary patch delta 7788 zcmbtZdt8)N`akcy@5l@w$VG?y3<83H2wss427y2`xg;t|jtHZSTxCF0u)%Q6(ppZ3 zR=0I)Ol=2sTU;!e0vE$Brdva~rKvS&mqD$iwzlE768oI@Lcq`d`Tbr#@6375b2-m> z&hvfFnS*UV+xC05+2(CdMurg0+i{y&hBpd?rSI9ScK}4TAGx{!vT5jH_wc3l3)qXet z_Z9o%8(|)J_XL=#4q3sH4Tax_ksCRas^X#+;=ANZYKrWpt7J2N&O+Shidt?A536|T z^!xF3ps7#PAIHOtLkE#qqwVTjsqLb^M>EKJ3!)M&M}tvbh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t index e542074..ab28f6f 100644 --- a/donnee/client.txt +++ b/donnee/client.txt @@ -1,4 +1,4 @@ 32 0.00 0 -660 11.03 0 +660 57.03 0 5079 75.50 0 8043 50.50 1 diff --git a/src/app/core_logic/client.c b/src/app/core_logic/client.c index 963261b..27d64e4 100644 --- a/src/app/core_logic/client.c +++ b/src/app/core_logic/client.c @@ -3,7 +3,6 @@ * @brief Fonctions liées à la gestion des clients et de leur panier. */ -#include #include "client.h" #define MAX_ARTICLES 100 @@ -43,6 +42,69 @@ int charger_clients(int numeros[], float cagnottes[], int suspendues[], int tPhy return i; } +/** + * @brief Sauvegarde les données clients dans un fichier. + * + * Cette fonction permet de sauvegarder les données clients, y compris les numéros de clients, les cagnottes, + * et les états de suspension, dans un fichier texte. + * + * @param numeros - Tableau des numéros de clients. + * @param cagnottes - Tableau des cagnottes des clients. + * @param suspendus - Tableau des états de suspension des clients. + * @param nombreClients - Nombre de clients. + */ +void sauvegarde_clients(int numeros[], float cagnottes[], int suspendus[], int nombreClients) { + FILE *fe; + fe = fopen("donnee/client.txt", "w"); + if (fe == NULL) { + perror("fopen"); + return; + } + for (int i = 0; i < nombreClients; i++) { + fprintf(fe, "%d %.2f %d\n", numeros[i], cagnottes[i], suspendus[i]); + } + fclose(fe); +} + +/** + * @brief Recherche l'index de l'article dans le tableau des références. + * + * Cette fonction recherche l'index de l'article avec la référence donnée dans le tableau des références. + * + * @param reference - Référence de l'article à rechercher. + * @param references - Tableau des références des articles. + * @param nombreArticles - Nombre d'articles disponibles. + * @return L'index de l'article s'il est trouvé, sinon -1. + */ +int trouver_index_article(int reference, int references[], int nombreArticles) { + for (int i = 0; i < nombreArticles; i++) { + if (references[i] == reference) { + return i; + } + } + return -1; +} + +/** + * @brief Trouve l'index d'un client dans le tableau des numéros de clients. + * + * Cette fonction recherche le numéro du client dans le tableau des numéros de clients + * et retourne l'index du client s'il est trouvé. + * + * @param numeroClient - Numéro du client à rechercher. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients dans le tableau. + * @return L'index du client s'il est trouvé, -1 sinon. + */ +int trouver_index_client(int numeroClient, int numeros[], int nombreClients) { + for (int i = 0; i < nombreClients; i++) { + if (numeros[i] == numeroClient) { + return i; // Retourne l'index du client si trouvé + } + } + return -1; // Retourne -1 si le client n'est pas trouvé +} + /** * @brief Ajoute un article au panier du client. @@ -84,24 +146,10 @@ void ajouter_article_au_panier(int numeroClient, int references[], float poids[] } while (getchar() != '\n'); - int articleIndex = -1; - for (int i = 0; i < nombreArticles; i++) { - if (references[i] == reference) { - articleIndex = i; - break; - } - } + int articleIndex = trouver_index_article(reference, references, nombreArticles); if (articleIndex == -1) { printf("Article non trouvé. Veuillez entrer une référence valide.\n"); - return; - } - - for (int i = 0; i < *taillePanier; i++) { - if (panier[i] == reference) { - printf("Cet article est déjà dans le panier.\n"); - return; - } } float poidsTotal = poids[articleIndex] * quantite; @@ -114,13 +162,7 @@ void ajouter_article_au_panier(int numeroClient, int references[], float poids[] } else { float montantTotal = prixUnitaire[articleIndex] * quantite; - int clientIndex = -1; - for (int i = 0; i < nombreClients; i++) { - if (numeros[i] == numeroClient) { - clientIndex = i; - break; - } - } + int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); if (clientIndex != -1) { cagnottes[clientIndex] += 0.1 * montantTotal; @@ -171,13 +213,7 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie } while (getchar() != '\n'); - int articleIndex = -1; - for (int i = 0; i < *taillePanier; i++) { - if (panier[i] == reference) { - articleIndex = i; - break; - } - } + int articleIndex = trouver_index_article(reference, panier, *taillePanier); if (articleIndex == -1) { printf("Article non trouvé dans le panier. Veuillez entrer une référence valide.\n"); @@ -194,11 +230,11 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie printf("Article supprimé du panier avec succès.\n"); } - /** * @brief Affiche un récapitulatif du contenu du panier. * - * Cette fonction permet d'afficher un récapitulatif du contenu du panier. + * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, + * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. * * @param panier - Tableau des références des articles dans le panier. * @param taillePanier - Taille du panier. @@ -207,25 +243,30 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie * @param volume - Tableau des volumes des articles. * @param prixUnitaire - Tableau des prix unitaires des articles. * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param cagnottes - Tableau des cagnottes des clients. + * @param numeroClient - Numéro du client. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. */ void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], - float prixUnitaire[], int quantites[]) { + float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, + int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale) { + printf("Contenu du panier : "); + for (int i = 0; i < taillePanier; i++) { + printf("%d ", panier[i]); + } + printf("\n"); + + printf("Récap :\n"); printf("Réf Qté Poids Vol PrixU PoidsTot VolTot PrixTot\n"); + float poidsTotal = 0, volumeTotal = 0, montantTotal = 0; + for (int i = 0; i < taillePanier; i++) { int reference = panier[i]; - int articleIndex = -1; - for (int j = 0; j < MAX_ARTICLES; j++) { - if (references[j] == reference) { - articleIndex = j; - break; - } - } - - if (articleIndex == -1) { - printf("Article non trouvé. Veuillez entrer une référence valide.\n"); - return; - } + int articleIndex = trouver_index_article(reference, references, MAX_ARTICLES); float poidsArticle = poids[articleIndex]; float volumeArticle = volume[articleIndex]; @@ -241,9 +282,14 @@ void affiche_recap_panier(int panier[], int taillePanier, int references[], floa montantTotal += prixArticle * quantite; } + int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); + printf("Prix total à payer: %.2f euros\n", montantTotal); + printf("Cagnotte totale : %.2f euros\n", cagnottes[clientIndex]); printf("Volume utilise : %.2f litres\n", volumeTotal); + printf("Volume restant : %.2f litres\n", volumeCoffre - volumeTotal); printf("Charge Actuelle: %.2f kg\n", poidsTotal); + printf("Charge restante: %.2f kg\n", chargeMaximale - poidsTotal); } /** @@ -336,15 +382,4 @@ void deduire_cagnotte(int numeroClient, float montant, int numeros[], float cagn } cagnottes[clientIndex] -= montant; - - FILE *fe; - fe = fopen("donnee/client.txt", "w"); - if (fe == NULL) { - perror("fopen"); - return; - } - for (int i = 0; i < nombreClients; i++) { - fprintf(fe, "%d %.2f %d\n", numeros[i], cagnottes[i], suspendus[i]); - } - fclose(fe); } \ No newline at end of file diff --git a/src/app/core_logic/client.h b/src/app/core_logic/client.h index 2aa3ff8..20ac047 100644 --- a/src/app/core_logic/client.h +++ b/src/app/core_logic/client.h @@ -20,6 +20,20 @@ */ int charger_clients(int numeros[], float cagnottes[], int suspendues[], int tPhysique); + +/** + * @brief Sauvegarde les données clients dans un fichier. + * + * Cette fonction permet de sauvegarder les données clients, y compris les numéros de clients, les cagnottes, + * et les états de suspension, dans un fichier texte. + * + * @param numeros - Tableau des numéros de clients. + * @param cagnottes - Tableau des cagnottes des clients. + * @param suspendus - Tableau des états de suspension des clients. + * @param nombreClients - Nombre de clients. + */ +void sauvegarde_clients(int numeros[], float cagnottes[], int suspendus[], int nombreClients); + /** * @brief Ajoute un article au panier du client. * @@ -55,6 +69,9 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie /** * @brief Affiche un récapitulatif du contenu du panier. * + * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, + * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. + * * @param panier - Tableau des références des articles dans le panier. * @param taillePanier - Taille du panier. * @param references - Tableau des références des articles. @@ -62,10 +79,16 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie * @param volume - Tableau des volumes des articles. * @param prixUnitaire - Tableau des prix unitaires des articles. * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param cagnottes - Tableau des cagnottes des clients. + * @param numeroClient - Numéro du client. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. */ void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], - float prixUnitaire[], int quantites[]); - + float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, + int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale); /** * @brief Modifie la quantité d'un article dans le panier du client. * @@ -96,4 +119,29 @@ void reinitialiser_panier(int panier[], int quantites[], int *taillePanier); */ void deduire_cagnotte(int numeroClient, float montant, int numeros[], float cagnottes[], int nombreClients, int suspendus[]); +/** + * @brief Recherche l'index de l'article dans le tableau des références. + * + * Cette fonction recherche l'index de l'article avec la référence donnée dans le tableau des références. + * + * @param reference - Référence de l'article à rechercher. + * @param references - Tableau des références des articles. + * @param nombreArticles - Nombre d'articles disponibles. + * @return L'index de l'article s'il est trouvé, sinon -1. + */ +int trouver_index_article(int reference, int references[], int nombreArticles); + +/** + * @brief Trouve l'index d'un client dans le tableau des numéros de clients. + * + * Cette fonction recherche le numéro du client dans le tableau des numéros de clients + * et retourne l'index du client s'il est trouvé. + * + * @param numeroClient - Numéro du client à rechercher. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients dans le tableau. + * @return L'index du client s'il est trouvé, -1 sinon. + */ +int trouver_index_client(int numeroClient, int numeros[], int nombreClients); + #endif // SAE_101_CLIENT_H diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 92ffa6c..a235948 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -4,9 +4,6 @@ */ #include "interface_client.h" -#include "app/core_logic/client.h" -#include "app/core_logic/responsable.h" - #define MAX_ARTICLES 100 #define MAX_CLIENTS 100 @@ -19,15 +16,15 @@ void affiche_client() { printf("|| Bonjour ! ||\n"); printf("+-------------+\n"); printf("\n"); - printf("+-----------------------------------------------------------------+\n"); - printf("|| Que voulez-vous faire ?\t\t\t\t\t\t\t||\n"); - printf("||\t1 : Afficher le récapitulatif du panier.\t\t\t||\n"); - printf("||\t2 : Ajouter un article au panier.\t\t\t\t||\n"); - printf("||\t3 : Supprimer un article du panier.\t\t\t\t||\n"); - printf("||\t4 : Modifier la quantité d'un article du panier.\t||\n"); - printf("||\t5 : Réinitialiser le panier.\t\t\t\t\t||\n"); - printf("||\t9 : Quitter.\t\t\t\t\t\t\t\t\t||\n"); - printf("+-----------------------------------------------------------------+\n"); + printf("+----------------------------------------------------------------+\n"); + printf("|| Que voulez-vous faire ?\t\t\t\t\t||\n"); + printf("||\t1 : Afficher le récapitulatif du panier.\t \t||\n"); + printf("||\t2 : Ajouter un article au panier. \t\t\t||\n"); + printf("||\t3 : Supprimer un article du panier. \t\t\t||\n"); + printf("||\t4 : Modifier la quantité d'un article du panier. \t||\n"); + printf("||\t5 : Réinitialiser le panier.\t\t\t\t||\n"); + printf("||\t9 : Quitter.\t\t\t\t\t\t||\n"); + printf("+----------------------------------------------------------------+\n"); } /** @@ -111,7 +108,8 @@ void global_client() { switch (choix) { case 1: - affiche_recap_panier(panier, taillePanier, references, poids, volume, prixUnitaire, quantites); + affiche_recap_panier(panier, taillePanier, references, poids, volume, prixUnitaire, quantites, cagnottes, + numeroClient, numeros, nombreClients, volumeCoffre, chargeMaximale); break; case 2: ajouter_article_au_panier(numeroClient, references, poids, volume, prixUnitaire, numeros, cagnottes, @@ -140,6 +138,7 @@ void global_client() { printf("Le montant a été déduit de votre cagnotte.\n"); } + sauvegarde_clients(numeros, cagnottes, suspendus, nombreClients); printf("Au revoir !\n"); return; default: diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index 2885394..2ae7dc7 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -4,6 +4,8 @@ */ #include +#include "../core_logic/client.h" +#include "../core_logic/responsable.h" /** * @brief Affiche le menu principal de l'interface client. -- 2.36.3 From bc281353835af2c7e0b7032b0e6e29161ae91c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 17:03:21 +0100 Subject: [PATCH 11/12] some modification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52400 -> 52448 bytes donnee/client.txt | 2 +- src/app/core_logic/client.c | 60 ++++++++++++++----- src/app/core_logic/client.h | 3 +- src/app/interface/interface_client.c | 85 +++++++++++++++------------ src/app/interface/interface_client.h | 2 + 6 files changed, 97 insertions(+), 55 deletions(-) diff --git a/app b/app index cfb49ba55316b08b2aaaab78651dae70c093f124..fcc8291edd9741f7933978935ddbea36b5db0ea5 100755 GIT binary patch delta 6690 zcmZ`-3s_Ufww|561BrlwA|MKchl1b(pC~E>LB$uM^+AOikwl0f;UwS-+u)6@^=j{7 z99!-AXp898fLiH?ZOJK|qs3coOMB2-4_fLCpf*0vE%s2GSdhDBKagt6_k}(G%)i#G z$IP19yY_9?{x)0QGSoT?AqFAj8w>y7&pHctBn)lH7kUeXPSlW3CNl{>QGh8qVVKY# zRkw@T!!UNDWTynCvk1wcKLCE^7Z92N&vO?MQm|w-8_yIG%qDuvUfP^q@%F6K6>ol5 zHSLYRze?=v4B7g863C^ENd=))5E=_VZ&3+6P>_gQzJPvN9p(b#%zaJha&M`uy4Qj* z40oZ*SZwz|E?-Y{kjGZQ?#SgW;RmtU3)*&fwabG(J=89xG!{DvS6V`xatW&^W0}-$ zo{alEM4gAH;2xnpxeKLF#V%<;F%3VG+FjG|zomBhble5)N{hz%e*`B+aoy8#CuvL! z;AY3+|0UNGbC^alM;(~kg;L}2CqTX4*XQ3`I=349!{=DdwZ0|>{B#398Q#VtY>2a} zDY*V98|*x033A>ZiClO5k&E})8HZ~?2V}_C;jebxWf6{I#4(ugxCaT=_%Vm*jLW;w zu^ISHU_XEvDH}0r+YvCds%c&QdUuFWB(gao)i#A3O>(%u7kCMwII5YSY4=S08p!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z&-|}hB_qM;jiMKIpUk$I0 zea~&_j#2$T9S&}v_WRLmmtXte*Ysobb(Jr;_4nQWv8!WGV)g}oRqFl7h_sVFwHJpa zp+D?;ZRpO{t3RDy{}1<9d=qXT3@oe-EI(_%aKe4u1yXH#aB<36J}WzRb(HhPtn=Ug zslVA{ed)I2kv7~?H~Eziofj8YJGHNM$$)19^Lq2W@>Rq$HQ4(*CUk%&7zNq r=0c6?U_$&K$6s6Q@~^K>{UyA$>ur5)o diff --git a/donnee/client.txt b/donnee/client.txt index ab28f6f..33e7cb7 100644 --- a/donnee/client.txt +++ b/donnee/client.txt @@ -1,4 +1,4 @@ 32 0.00 0 -660 57.03 0 +660 57.63 0 5079 75.50 0 8043 50.50 1 diff --git a/src/app/core_logic/client.c b/src/app/core_logic/client.c index 27d64e4..4cbd40c 100644 --- a/src/app/core_logic/client.c +++ b/src/app/core_logic/client.c @@ -126,39 +126,67 @@ int trouver_index_client(int numeroClient, int numeros[], int nombreClients) { * @param panier - Tableau des références des articles dans le panier. * @param quantites - Tableau des quantités de chaque article dans le panier. * @param taillePanier - Taille du panier. + * @param budget - Budget du client. */ void ajouter_article_au_panier(int numeroClient, int references[], float poids[], float volume[], float prixUnitaire[], int numeros[], float cagnottes[], int suspendues[], int nombreArticles, int nombreClients, - float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier) { - int reference, quantite; + float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier, float budget) { - printf("Entrez la référence de l'article : "); - while (scanf("%d", &reference) != 1) { + int reference, quantite, articleIndex; + float poidsTotal, montantTotal, volumeTotal, depassementCharge = 0, depassementVolume, depassementBudget = 0; + + while (1) { + printf("Entrez la référence de l'article : "); + while (scanf("%d", &reference) != 1) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une référence valide (nombre) : "); + } while (getchar() != '\n'); - printf("ERREUR : Veuillez entrer une référence valide (nombre) : "); + + articleIndex = trouver_index_article(reference, references, nombreArticles); + + if (articleIndex == -1) { + printf("ERREUR : Article non trouvé. Veuillez entrer une référence valide.\n"); + } else { + break; + } } - while (getchar() != '\n'); printf("Entrez la quantité : "); while (scanf("%d", &quantite) != 1) { while (getchar() != '\n'); - printf("ERREUR : Veurillez entrer une quantité valide (nombre) : "); + printf("ERREUR : Veuillez entrer une quantité valide (nombre) : "); } while (getchar() != '\n'); - int articleIndex = trouver_index_article(reference, references, nombreArticles); + poidsTotal = poids[articleIndex] * quantite; + volumeTotal = volume[articleIndex] * quantite; + montantTotal = prixUnitaire[articleIndex] * quantite; - if (articleIndex == -1) { - printf("Article non trouvé. Veuillez entrer une référence valide.\n"); + if (poidsTotal > chargeMaximale) { + depassementCharge = poidsTotal - chargeMaximale; } - float poidsTotal = poids[articleIndex] * quantite; - float volumeTotal = volume[articleIndex] * quantite; + if (volumeTotal > volumeCoffre) { + depassementVolume = volumeTotal - volumeCoffre; + } - if (poidsTotal > chargeMaximale) { - printf("Désolé, dépassement de la charge autorisée.\n"); - } else if (volumeTotal > volumeCoffre) { - printf("Désolé, dépassement du volume autorisé.\n"); + if (budget > 0 && montantTotal > budget) { + depassementBudget = montantTotal - budget; + } + + if (depassementCharge || depassementVolume || depassementBudget) { + printf("Attention : "); + if (depassementCharge) { + printf("dépassement de la charge autorisée de %.2f kg \n", depassementCharge); + } + if (depassementVolume) { + printf("dépassement du volume autorisé de %.2f litres \n", depassementVolume); + } + if (depassementBudget) { + printf("dépassement du budget autorisé de %.2f euros \n", depassementBudget); + } + printf("\n"); } else { float montantTotal = prixUnitaire[articleIndex] * quantite; diff --git a/src/app/core_logic/client.h b/src/app/core_logic/client.h index 20ac047..c3f9717 100644 --- a/src/app/core_logic/client.h +++ b/src/app/core_logic/client.h @@ -52,10 +52,11 @@ void sauvegarde_clients(int numeros[], float cagnottes[], int suspendus[], int n * @param panier - Tableau des références des articles dans le panier. * @param quantites - Tableau des quantités de chaque article dans le panier. * @param taillePanier - Taille du panier. + * @param budget - Budget du client. */ void ajouter_article_au_panier(int numeroClient, int references[], float poids[], float volume[], float prixUnitaire[], int numeros[], float cagnottes[], int suspendues[], int nombreArticles, int nombreClients, - float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier); + float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier, float budget); /** * @brief Supprime un article du panier du client. diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index a235948..c16132d 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -41,6 +41,51 @@ void menu_client(int *choix) { } } +void configurer_session_client(int numeros[], int suspendus[], int nombreClients, float *budget, float *volumeCoffre, float *chargeMaximale, int *numeroClient) { + printf("Veuillez saisir votre numéro de client : "); + while (scanf("%d", numeroClient) != 1) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer un numéro de client valide : "); + } + + int indexClient = trouver_index_client(*numeroClient, numeros, nombreClients); + + if (indexClient == -1) { + printf("Client non trouvé. Impossible d'utiliser l'application.\n"); + return; + } + + if (suspendus[indexClient] == 1) { + printf("Le client est suspendu et ne peut pas utiliser l'application.\n"); + return; + } + + printf("Voulez-vous définir un budget à ne pas dépasser ? (1 pour Oui, 0 pour Non) : "); + int choixBudget; + scanf("%d", &choixBudget); + + if (choixBudget == 1) { + printf("Entrez le budget à ne pas dépasser : "); + while (scanf("%f", budget) != 1 || *budget <= 0) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer un budget valide (nombre positif) : "); + } + } + + printf("Veuillez saisir la taille disponible du véhicule (en litres) : "); + while (scanf("%f", volumeCoffre) != 1 || *volumeCoffre <= 0) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une taille de coffre valide (en litres) : "); + } + + printf("Veuillez saisir la charge maximale autorisée (en kg) : "); + while (scanf("%f", chargeMaximale) != 1 || *chargeMaximale <= 0) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une charge maximale valide (en kg) : "); + } +} + + /** * @brief Fonction principale de l'interface client. * @@ -63,45 +108,11 @@ void global_client() { int quantites[MAX_ARTICLES]; int panier[MAX_ARTICLES]; int taillePanier = 0; + float budget = -1.0; nombreArticles = chargementArticles(references, poids, volume, prixUnitaire, MAX_ARTICLES); nombreClients = charger_clients(numeros, cagnottes, suspendus, MAX_CLIENTS); - - printf("Veuillez saisir la taille disponible du véhicule (en litres) : "); - while (scanf("%f", &volumeCoffre) != 1 || volumeCoffre <= 0) { - while (getchar() != '\n'); - printf("ERREUR : Veuillez entrer une taille de coffre valide (en litres) : "); - } - - printf("Veuillez saisir la charge maximale autorisée (en kg) : "); - while (scanf("%f", &chargeMaximale) != 1 || chargeMaximale <= 0) { - while (getchar() != '\n'); - printf("ERREUR : Veuillez entrer une charge maximale valide (en kg) : "); - } - - printf("Veuillez saisir votre numéro de client : "); - while (scanf("%d", &numeroClient) != 1) { - while (getchar() != '\n'); - printf("ERREUR : Veuillez entrer un numéro de client valide : "); - } - - int indexClient = -1; - for (int i = 0; i < nombreClients; i++) { - if (numeros[i] == numeroClient) { - indexClient = i; - break; - } - } - - if (indexClient == -1) { - printf("Client non trouvé. Impossible d'utiliser l'application.\n"); - return; - } - - if (suspendus[indexClient] == 1) { - printf("Le client est suspendu et ne peut pas utiliser l'application.\n"); - return; - } + configurer_session_client(numeros, suspendus, nombreClients, &budget, &volumeCoffre, &chargeMaximale, &numeroClient); do { menu_client(&choix); @@ -113,7 +124,7 @@ void global_client() { break; case 2: ajouter_article_au_panier(numeroClient, references, poids, volume, prixUnitaire, numeros, cagnottes, - suspendus, nombreArticles, nombreClients, volumeCoffre, chargeMaximale, panier, quantites, &taillePanier); + suspendus, nombreArticles, nombreClients, volumeCoffre, chargeMaximale, panier, quantites, &taillePanier, budget); break; case 3: supprimer_article_du_panier(panier, quantites, &taillePanier); diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index 2ae7dc7..26ef1a7 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -27,3 +27,5 @@ void menu_client(int *choix); * d'articles dans le panier. */ void global_client(); + +void configurer_session_client(int numeros[], int suspendus[], int nombreClients, float *budget, float *volumeCoffre, float *chargeMaximale, int *numeroClient); -- 2.36.3 From bc15ce62f7801d0578ed36a5da0fba5f7a1c331a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 17:05:59 +0100 Subject: [PATCH 12/12] some modification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52448 -> 0 bytes src/app/interface/interface_client.c | 14 ++++++++++++++ src/app/interface/interface_client.h | 17 ++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) delete mode 100755 app diff --git a/app b/app deleted file mode 100755 index fcc8291edd9741f7933978935ddbea36b5db0ea5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52448 zcmeHw4|G)3x$mBt1d;%Pf+8T~gntQt1OydCtwRG9TPlAYXG=Cum#Ri#AbW-tXIgX3m*R z5?1eB>%F(u89h1Y+xy$!{`PNw`}_9ZXV~-GFaG$|aK;=AA1AKMaaCk6_B1o_#Mn4o z%W-);tCrlp?EYnIR#K|!#3w^bmMI=jC|tE6l*mq%*R)Z}D_0yuo8@IGdB9M7Jf5OZ zxY8deP0-f%7C;cS_iLji1JUM>SvI9ZUN8_!HaJzkvL~dxEG2|!msw!Sv&T~vc-$W- z_V@!OK_TC&UxkvlLzN>sRVTAZ>epRD&eA1omv{JHR3PRH0eke zVKEAq$5R?iwvy=d^45V@d}^%i9D>AbnIrxt?RLc-cYbTx(mSM9j2%hQ3p9OVssl+M zVUHq}vFo8Z=||KTsw|3HV5}3Z!?yK^kH~jh0FYz0)j5e>+e&6 z@?+9uUWPOS7pXb7DpWbQ+`nON@s{#p(Da#ri}Y|lxM|hyAKv`x?tlEZy*GUC=TFZ^ znt@BUiKJX6o}nURL;vQQiJNF2(fAageI(~$*tz*b^)A9C>JS-=Ff1KOU7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..060c539 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -41,6 +41,20 @@ void menu_client(int *choix) { } } + +/** + * @brief Affiche le récapitulatif du panier. + * + * Cette fonction affiche le récapitulatif du panier, y compris les références, les poids, les volumes, les prix unitaires, elle permet d'initialiser la session du client. + * + * @param numeros + * @param suspendus + * @param nombreClients + * @param budget + * @param volumeCoffre + * @param chargeMaximale + * @param numeroClient + */ void configurer_session_client(int numeros[], int suspendus[], int nombreClients, float *budget, float *volumeCoffre, float *chargeMaximale, int *numeroClient) { printf("Veuillez saisir votre numéro de client : "); while (scanf("%d", numeroClient) != 1) { diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index 26ef1a7..ebe7eca 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -19,6 +19,22 @@ void affiche_client(); */ void menu_client(int *choix); + +/** + * @brief Affiche le récapitulatif du panier. + * + * Cette fonction affiche le récapitulatif du panier, y compris les références, les poids, les volumes, les prix unitaires, elle permet d'initialiser la session du client. + * + * @param numeros + * @param suspendus + * @param nombreClients + * @param budget + * @param volumeCoffre + * @param chargeMaximale + * @param numeroClient + */ +void configurer_session_client(int numeros[], int suspendus[], int nombreClients, float *budget, float *volumeCoffre, float *chargeMaximale, int *numeroClient); + /** * @brief Fonction principale de l'interface client. * @@ -28,4 +44,3 @@ void menu_client(int *choix); */ void global_client(); -void configurer_session_client(int numeros[], int suspendus[], int nombreClients, float *budget, float *volumeCoffre, float *chargeMaximale, int *numeroClient); -- 2.36.3