Git Product home page Git Product logo

wateroverflow's Introduction

Water Overflow

Problem

There is a stack of water glasses in a form of triangle as illustrated. Each glass has a 250ml capacity. When a liquid is poured into the top most glass any overflow is evenly distributed between the glasses in the next row. That is, half of the overflow pours into the left glass while the remainder of the overflow pours into the right glass.

Write a program that is able to calculate and illustrate how much liquid is in the j-th glass of the i-th row when K litres are poured into the top most glass. The solution can be a command line tool or have a graphical interface.

Quick Start

JAVA

You will need JAVA with JRE with Java SE 15(sep 2020) installed and setup on your system. Moreover, for test cases you'll need to install the JUnit 4.10 or higher. If your system does not have it, I recommend installing it from (https://junit.org/junit4/). No other dependencies should be required.

  1. Clone this repo.

    git clone https://github.com/Rush-abh/WaterOverflow.git
  2. Open Project.

    open project in code editor
  3. Run the Main file.

    Run "WaterOverflowMain.java" as Java Application

OR

  1. Open folder with executable(jar) file.

     WaterOverflow.jar
  2. Open cmd in folder and Run the JAR file command.

    Press ALT+D, type cmd, hit enter
    java -jar WaterOverflow.jar

You should see the expected output according to custom input. Try with different values of k i and j to see the results. E.g for input (4,5,5)

Amount of water in 5th glass of 5 row is: 15.625

Note: This implementation has limitation set of K till 10. The input assumes i and j starts from 1.

Testing

The project utilises the JUnit for developing the test cases of application. The tests on this program tries to prove out the basic functionality. See file in test package src/tests/WOTests.java

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.