Giter VIP home page Giter VIP logo

product-basket's Introduction

Product-Basket

Overview

This program calculates the total price of a basket of products and determines whether the delivery is free or not based on the basket's total value.

Input Files

1- Basket List File (PANIER.txt):

  • Contains the list of baskets.
  • Each record includes a basket key. 2- Product List File (PANPRD.txt):
  • Contains the list of products within each basket.
  • Each record includes the basket key, product code, and product price.

Output File

  • Total per Basket File (SortiePanier.txt):
    • Contains the total price, number of products, and delivery status (free, paid, or canceled) for each basket.

Delivery Conditions

  • Delivery is free (G) for baskets with a total value exceeding 100€.
  • For baskets with no products, delivery is canceled (A).
  • For baskets with a total value less than 100€, delivery is paid (P), with a fixed delivery charge of 14.55€.

Program Execution

1- Initialization:

  • Open input and output files.
  • Initialize variables, counters, and flags. 2- Processing:
  • Read each basket and its associated products from the input files.
  • Calculate the total price of each basket and determine the delivery status.
  • Write the total price, number of products, and delivery status to the output file. 3- Completion:
  • Close all files.
  • Display summary information, including the number of input records, output records, and encountered errors.
  • Terminate the program.

File Handling

  • Sequential file handling is used for input and output operations.
  • File status codes (L-Fst-In1, L-Fst-In2, L-Fst-Out, L-Fst-Err) are used for error handling.

Error Handling

  • Errors encountered during file operations or processing are logged in the error file (SortieErreur.txt).
  • Error messages include details of the erroneous records.

Conclusion

This program provides a solution for calculating the total price of product baskets and determining delivery status based on predefined conditions. It efficiently processes input data, handles errors gracefully, and generates accurate output.

product-basket's People

Contributors

marzakbrahim avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.