correction sur basket add(ajout de l'appel de basket_display)

doc
Julien ABADIE 1 year ago
parent 4e5e28e3c5
commit 9cd95e4b33

@ -106,13 +106,11 @@ void displayClientList(int clientID[], float cagnotte[], int suspended[], int is
* @param volume: tableau du volume des articles * @param volume: tableau du volume des articles
* @param unitPrice: tableau du prix unitaire des articles * @param unitPrice: tableau du prix unitaire des articles
* @param cagnotte: pointeur indiquant la valeur de la cagnotte * @param cagnotte: pointeur indiquant la valeur de la cagnotte
* @param weight_constraint: var float contenant la contrainte de la charge maximale du véicule
* @param volume_constraint: var float contenant la contrainte du volume maximal du véicule
* @param tlog: taille logique du tableau `tab_reference` * @param tlog: taille logique du tableau `tab_reference`
* @param tlog_basket: taille logique du panier * @param tlog_basket: taille logique du panier
* @return Rien * @return Rien
*/ */
void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte,float weight_constraint, float volume_constraint, int tlog, int tlog_basket) void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte, int tlog, int tlog_basket)
{ {
float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket], cagnotte_line[tlog_basket], total_weight, total_volume, total_price; float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket], cagnotte_line[tlog_basket], total_weight, total_volume, total_price;
int i; int i;
@ -137,26 +135,27 @@ void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], floa
printf("\t\t\t\t\tPrix total à payer: %f\t euros\n", total_price); printf("\t\t\t\t\tPrix total à payer: %f\t euros\n", total_price);
printf("\t\t\t\t\tCagnotte totale: %f\t euros\n", *cagnotte); printf("\t\t\t\t\tCagnotte totale: %f\t euros\n", *cagnotte);
//constraintExceeded( weightConstraint, volumeConstraint, *priceConstraint, *cagnotte, tabWeight[], tabVolume[], tabPrice[], tabItemRef[], tabBasketRef[], tabBasketQuantity[], tlogItem, int tlogBasket)
if (volume_constraint<total_volume)
{ // if (volume_constraint<total_volume)
printf("Volume actuel:%.2f\n", total_volume); // {
printf("Volume restant: Attention, dépasssement du volume autorisé de %2.f, veuillez suprimer des articles",total_volume - volume_constraint); // printf("Volume actuel:%.2f\n", total_volume);
} // printf("Volume restant: Attention, dépasssement du volume autorisé de %2.f, veuillez suprimer des articles",total_volume - volume_constraint);
else // }
{ // else
printf("Volume actuel:%.2f\n", total_volume); // {
printf("Volume restant:%2.f\n", volume_constraint - total_volume); // printf("Volume actuel:%.2f\n", total_volume);
} // printf("Volume restant:%2.f\n", volume_constraint - total_volume);
// }
if (weight_constraint<total_weight)
{ // if (weight_constraint<total_weight)
printf("Charge actuelle:\t%2.f",total_weight); // {
printf("Attention, dépasssement de la charge autorisée de %2.f, veuillez suprimer des articles", total_weight - weight_constraint); // printf("Charge actuelle:\t%2.f",total_weight);
} // printf("Attention, dépasssement de la charge autorisée de %2.f, veuillez suprimer des articles", total_weight - weight_constraint);
else // }
{ // else
printf("Charge actuelle:\t%2.f",total_weight); // {
printf("Charge restante:\t%2.f", volume_constraint - total_volume); // printf("Charge actuelle:\t%2.f",total_weight);
} // printf("Charge restante:\t%2.f", volume_constraint - total_volume);
// }
} }

@ -49,7 +49,7 @@ int searchTab(int targetTab[], int valSearched, int tLog, int *found);
void clientConstraint(float *weight, float *volume, float *price); void clientConstraint(float *weight, float *volume, float *price);
int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket); int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket);
int basket_add (int tab_reference[], float weight[], float volume[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[],int tlog, int tlog_basket); int basket_add (int tab_reference[], float weight[], float volume[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[],int tlog, int tlog_basket);
void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte,float weight_constraint, float volume_constraint, int tlog, int tlog_basket); void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte, int tlog, int tlog_basket);
int reinit_basket(int tlog_basket); int reinit_basket(int tlog_basket);
int basket_del_article( int basket_tab_ref[], int basket_tab_qte[], int tlog_basket); int basket_del_article( int basket_tab_ref[], int basket_tab_qte[], int tlog_basket);

@ -30,27 +30,29 @@ void clientConstraint(float *weight, float *volume, float *price)
} }
} }
// TODO réécrire cette documentation
/** /**
* The function checks if the weight, volume, and price constraints are exceeded and allows the user to * The function checks if the weight, volume, and price constraints are exceeded based on the items in
* use their cagnotte (a type of credit) to stay within the price constraint. * the basket and the given constraints.
* *
* @param weightConstraint The weight constraint for the vehicle `float`. * @param weightConstraint The maximum weight constraint for the vehicle.
* @param volumeConstraint The volume constraint is the maximum volume that the vehicle can hold. It is * @param volumeConstraint The volume constraint is the maximum volume that the vehicle can hold.
* a float value.
* @param priceConstraint A pointer to a float variable representing the maximum budget constraint. * @param priceConstraint A pointer to a float variable representing the maximum budget constraint.
* @param tabWeight An array containing the weights of each item in the inventory. * @param cagnotte A pointer to a float variable representing the amount of money in the user's
* @param tabVolume tabVolume is an array that stores the volume of each item in the inventory. * account.
* @param tabUnitPrice tabUnitPrice is an array that stores the unit price of each item in the * @param tabWeight An array containing the weights of each item in the log.
* inventory. * @param tabVolume tabVolume is an array that stores the volume of each item in the shopping basket.
* @param tabQuantity tabQuantity is an array that stores the quantity of each item in the shopping * @param tabPrice tabPrice is an array that stores the prices of items in a shopping basket.
* cart. * @param tabItemRef An array containing the reference numbers of the items in the inventory.
* @param tlog The parameter "tlog" represents the number of items in the inventory or the number of * @param tabBasketRef tabBasketRef is an array that contains the references of the items in the
* items in the transaction log. * basket.
* @param cagnotte A pointer to a float variable representing the amount of money available for use. * @param tabBasketQuantity An array that stores the quantity of each item in the basket.
* * @param tlogItem The parameter "tlogItem" represents the number of items in the log.
* @return an integer value. * @param tlogBasket The parameter "tlogBasket" represents the number of items in the shopping basket.
* @return an integer value. If the constraints for weight, volume, or price are exceeded, the function
* returns -1. Otherwise, it returns 0.
*/ */
// TODO réécrire cette documentation
int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket) int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket)
{ {
int index, found, i; int index, found, i;
@ -154,9 +156,7 @@ int basket_add (int tab_reference[], float weight[], float volume[], float unitP
*cagnotte = *cagnotte + *cagnotte*0.10; *cagnotte = *cagnotte + *cagnotte*0.10;
tlog_basket = tlog_basket+1; tlog_basket = tlog_basket+1;
//! A corriger display_basket( basket_tab_ref, basket_tab_qte, weight, volume, unitPrice, *cagnotte, tlog, tlog_basket);
//display_basket(basket_tab_ref, basket_tab_qte, weight, volume, unitPrice, *cagnotte, weight_constraint, volume_constraint, tlog, tlog_basket);
return tlog_basket; return tlog_basket;
} }

Loading…
Cancel
Save