GithubHelp home page GithubHelp logo

flower_shop_console's Introduction

Flower Shop Console App

by Tophs Celestial

Versions

  • Ruby 2.4.1
  • RSpec 3.6

Instructions

To start the application run the command below

$ ruby flower_shop_console.rb

To see test suites run

$ rspec spec/lib

To see how the app works via rspec run

$ rspec spec/flower_shop_console_spec.rb

Look and Feel

Context

A flower shop used to base the price of their flowers on an item by item cost. So if a customer ordered 10 roses then they would be charged 10x the cost of single rose. The flower shop has decided to start selling their flowers in bundles and charging the customer on a per bundle basis. So if the shop sold roses in bundles of 5 and 10 and a customer ordered 15 they would get a bundle of 10 and a bundle of 5.

The flower shop currently sells the following products:

Name Code Bundle
Roses R12 5 @ $6.99
- - 10 @ $12.99
Lilies L09 3 @ $9.95
- - 6 @ $16.95
- - 9 @ $24.95
Tulips T58 3 @ $5.95
- - 5 @ $9.95
- - 9 @ $16.99

Task

Given a customer order you are required to determine the cost and bundle breakdown for each product. To save on shipping space each order should contain the minimal number of bundles.

Input:

Each order has a series of lines with each line containing the number of items followed by the product code

An example input:

10 R12
15 L09
13 T58

Output:

A successfully passing test(s) that demonstrates the following output: (The format of the output is not important)

10 R12 $12.99
        1 x 10 $12.99
15 L09 $41.90
        1 x 9 $24.95
        1 x 6 $16.95
13 T58 $25.85
        2 x 5 $9.95
        1 x 3 $5.95

Credits

Thanks to bbp-labs for their combination sum solution. Check the code here.

flower_shop_console's People

Contributors

ccelestial avatar

Watchers

 avatar  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.