A Java project simulating an online sales system for buyers and shops.
Handles order creation, delivery, and payments.
Utilizes city connections for transport and calculates discounts based on buyer's purchase history.
Explore the project »
Report Bug
·
Request Feature
Table of Contents
This project implements an online sales system that acts as an intermediary between buyers and shops for selling various products. The system handles order creation, order delivery, and payments.
The system consists of shops located in different cities that advertise their products with prices and quantities. Shops can define discounts that apply to all their products for a certain period.
Buyers can create orders by selecting products from multiple shops and specifying the quantities. After submitting the order, the system verifies if it can be fulfilled, proceeds with payment by deducting the amount from the buyer's virtual account within the system, and records each transaction separately. Once the payment is completed, the system automatically sends the order to the buyer. Orders have three states: "created" (order created but not completed), "sent" (order complete and sent to the buyer), and "arrived" (order has arrived in the buyer's city).
The cities are interconnected by transportation lines, allowing movement between them. The distance between cities is measured in transportation days. When an order is placed, it is transported in two steps. First, the products are transported from the respective shops to the nearest city (City A) that is closest to the buyer's city (City B). Then, the order is transported from City A to City B using the shortest path.
When an order arrives in the buyer's city, the system transfers the money to the associated shops. The system retains 5% of the total amount as profit and records each transaction with the shops individually.
The system also offers an additional 2% discount on orders if the buyer has made a transaction exceeding 10,000 in the last 30 days. In that case, the system reduces its profit from 5% to 3%.
The project requires a database that is created according to the specifications provided here.
The project consists of classes with the prefix "Solution" that implement various interfaces and their respective methods.
Additional methods, fields, and elements can be added to the classes as necessary. However, it is essential to implement the methods defined in the interfaces, as they will be called during testing.
To get a local copy up and running follow these simple steps.
Setup:
- Clone the repository:
git clone https://github.com/jovan-vukic/online-sales-system.git
- Set up the database by running the SQL script in the
db
directory. - Build and compile the project using your preferred Java IDE.
- Run the project to perform the tests of the functionalities.
A full demonstration of the working project:
Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Jovan - @jovan-vukic
Project Link: https://github.com/jovan-vukic/online-sales-system
Used resources: