Coder Social home page Coder Social logo

purchase-system's Introduction

Purchase system

In this project first we get the items from DB, then you can choose your items and after it, you can see your bill and price.

Getting Started

First of all, you have to create tables in your DB on your computer, for this, you have to run the DB.java file. After it, you can run Main.java for seeing the main program.

Prerequisites

You need to have H2 Database Engine on your computer. also, maybe you nees to add "h2-1.4.197.jar" to your Java build path.

How to work with program

After you run the Main.java, you can see the items in console, then you can choose your items in this way:

“item id” amount

After you finish your ordering you have to type “0” in the console to end the taking order process.

Then you can see your orders in the console and the total calculated price. If you see “Inserted records into the table...” message it means that your order inserted to DB successfully otherwise you see "Can't insert your record! :(" message.

DB Architecture

We have three tables, “ITEMS” table for record items and their prices, “ORDERS_BILL” table for record the orders and their total prices, “ORDERS_DETAIL” for record the items in any order, the Primary key in “ORDERS_BILL” table is Foreign key in “ORDERS_DETAIL”.

Note

If you insert an id twice or more, you will see the total amounts of that item in your bill. For calculate price I assume that we don’t have tax if you want to add tax you have to change the “tax” value in Main.java, also, You can make any changes you want in “calculatePrice()” function to change the total calculated price and you don’t need to change other part of code.

Authors

  • Amir hosein Safari

purchase-system's People

Contributors

amirhoseinsa avatar

Watchers

James Cloos 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.