Giter VIP home page Giter VIP logo

fare-app's Introduction

Fare App Calculation System

Build and Running on Local Maching

To build use make build or go build -v -o fare-app cmd/*.go. This will generate fare-app binary that can be run using ./fare-app.

To trigger both build and run, use make run

Flags

This application support two optional flags

  • -input: data input that will be processed by the application. If this is empty, application will start in console mode.

  • -config: json config file that will be used as application configuration. If this is empty, it will use default config specified in `./internal/model/config.go

Console Mode

In console mode, the app will wait for user input. Each data will be processed line by line, until reaching empty line, which triggers fare calculation.

If there's no error found, the output will be printed in standard output.

Example

run the app ./fare-app, and then input the following data:

00:00:00.000 0.0
00:01:00.123 480.9
00:02:00.125 1141.2

this will trigger the output of 440

File Mode

In file mode, the app will directly process inputted file. Each data will be processed line by line, until reaching end of file, which triggers fare calculation.

If there's no error found, the output will be printed in standard output.

Example

run the app ./fare-app -input sample_data.txt to run with provided sample data, inside the sample data is:

00:00:00.000 0.0
00:01:00.123 480.9
00:02:00.125 1141.2
00:03:00.100 1850.8

this will trigger the output of 520

Running the app without compiling on local

If building the app on local is not possible, the /bin folder includes some popular OS and architecture. Simply calls specific binary to use it. For example, on Linux 32-bit calls ./bin/linux_x86/fare-app to run the app.

All above flags and command is the same for all type of builds. For example ./bin/linux_x86/fare-app -input sample_data.txt -config config.json will trigger fare calculation on sample_data.txt using configuration from config.json

Note that, the binary included in the root folder is built on Mac, so it won't run on other OS.

fare-app's People

Contributors

alvian-pratama avatar xanvial 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.