Giter Site home page Giter Site logo

berlin-clock's Introduction

Berlin Clock Implementation

Implement the Berlin Clock as a function of the three parameters : hours (24-based), minutes, seconds and return a multi-line string. The time is calculated by adding the lit rectangular lamps.

  • The first line consist of 1 yellow circular lamp that blinks on/off every two seconds.
  • The next line consist of 4 red rectangular lamps, and every lamp represents 5 hours.
  • The next line consist of 4 red rectangular lamps, and every lamp represents 1 hour.
  • The next line consist of 11 rectangular lamps, and every lamp represents 5 minutes. The 3rd, 6th, and 9th are red indicating the first quarter, half, and the last quarter of the hour, while the rest are yellow.
  • The last line consist of 4 yellow lamps, and every lamp represents 1 minute.

For colour representation in this application, assume the following:

  • Yellow Lamps are represented by 'Y' when On
  • Red Lamps are represented by 'R' when On
  • Both Yellow and Red Lamps are represented by 'O' when Off

Prerequisites

  • JDK 8 and JAVA_HOME environment variable set

Building the project

Clone the repository:

git clone https://github.com/nazcompile/Berlin-Clock

Navigate to the newly created folder:

cd Berlin-Clock

Run the project:

  • For *nix OS run the command - ./gradlew clean build
  • For Windows OS run the command - gradlew.bat clean build

This might take a few minutes the first time it runs as it needs to download the dependencies it needs to build the code. The dependencies can be found in the build.gradle file inside dependencies { }

Running the application

  • Change directory to the newly created Berlin-Clock/build/distributions

  • Unpack any of the Berlin-Clock-1.0.zip or Berlin-Clock-1.0.tar files

  • Change directory to the unpacked directory (Berlin-Clock/build/distributions/Berlin-Clock-1.0)

This should contain

  • bin/
  • lib/
  • Run the program
  • For *nix OS run the command - bin/Berlin-Clock '24H_TIME'
  • For Windows OS run the command - bin\Berlin-Clock.bat '24H_TIME'

The 24H_TIME should be entered in this format: 'HH:mm:ss' Example - bin/Berlin-Clock '14:35:49'

Generated Documents

These documents will be generated as part of the build process

  • Java Documentation - Berlin-Clock/build/docs/javadoc/index.html

  • Unit Tests Code Coverage Report - Berlin-Clock/build/reports/jacoco/test/html/index.html

  • Unit Tests Report - Berlin-Clock/build/reports/tests/index.html

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.