|
|
|
@ -108,53 +108,30 @@ void displayClientList(int clientID[], float cagnotte[], int suspended[], int is
|
|
|
|
|
* @param cagnotte: pointeur indiquant la valeur de la cagnotte
|
|
|
|
|
* @param tlog: taille logique du tableau `tab_reference`
|
|
|
|
|
* @param tlog_basket: taille logique du panier
|
|
|
|
|
* @return Rien
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], int tlog, int tlog_basket)
|
|
|
|
|
void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float cagnotte[], float unitPrice[], 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];
|
|
|
|
|
float totalWeight = 0, totalVol = 0, total_price = 0;
|
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i<tlog_basket; i++)
|
|
|
|
|
{
|
|
|
|
|
total_weight_line[i] = basket_qte[i]*weight[i];
|
|
|
|
|
total_volume_line[i] = basket_qte[i]*volume[i];
|
|
|
|
|
total_price_line[i] = basket_qte[i]*unitPrice[i];
|
|
|
|
|
cagnotte_line[i] = total_price_line[i] * 0.10;
|
|
|
|
|
}
|
|
|
|
|
for (i=0; i<tlog_basket; i++)
|
|
|
|
|
{
|
|
|
|
|
total_price = total_price + total_price_line[i];
|
|
|
|
|
totalWeight += total_weight_line[i];
|
|
|
|
|
totalVol += total_volume_line [i];
|
|
|
|
|
total_price += total_price_line[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Récapitulatif de votre panier:\n");
|
|
|
|
|
printf("Référence\tQuantité\tPoids\tVolume\tPrixU\tPoidsTot\tVolTot\tPrixTot\tCagnotte\n");
|
|
|
|
|
printf("Référence\tQuantité\tPoids\tVolume\tPrix unitaire\tPoids Total\tVol Total\tPrix Total\n");
|
|
|
|
|
|
|
|
|
|
for (i=0; i<tlog_basket; i++)
|
|
|
|
|
printf("%d\t%d\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n", basket_tab_ref[i], basket_qte[i], weight[i], volume[i], unitPrice[i], total_weight_line[i], total_volume_line[i], total_price_line[i],cagnotte_line[i]);
|
|
|
|
|
printf("%d\t%d\t%f\t%f\t%f\t%f\t%f\t%f\n", basket_tab_ref[i], basket_qte[i], weight[i], volume[i], unitPrice[i], total_weight_line[i], total_volume_line[i], total_price_line[i]);
|
|
|
|
|
|
|
|
|
|
printf("\t\t\t\t\tPrix total à payer: %f\t euros\n", total_price);
|
|
|
|
|
|
|
|
|
|
//constraintExceeded( weightConstraint, volumeConstraint, *priceConstraint, *cagnotte, tabWeight[], tabVolume[], tabPrice[], tabItemRef[], tabBasketRef[], tabBasketQuantity[], tlogItem, int tlogBasket)
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// printf("Volume actuel:%.2f\n", total_volume);
|
|
|
|
|
// printf("Volume restant:%2.f\n", volume_constraint - total_volume);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// printf("Charge actuelle:\t%2.f",total_weight);
|
|
|
|
|
// printf("Charge restante:\t%2.f", volume_constraint - total_volume);
|
|
|
|
|
// }
|
|
|
|
|
printf("Prix total: %f€\n", total_price);
|
|
|
|
|
printf("Poids total: %fkg\n", totalWeight);
|
|
|
|
|
printf("Volume total: %fm³\n", totalVol);
|
|
|
|
|
}
|
|
|
|
|