Code Monkey home page Code Monkey logo

kata_harrypotter's Introduction

#Kata: Harry Potter

####Organisatorisches: ######Git-Url:

###Beschreibung:

Ein Buchhändler hat sich ein neues Rabattsystem für Harry Potter Bücher einfallen lassen. Sie sollen dieses Rabattsystem implementieren und für den Kunden immer das günstigste Angebot berechnen.

###Aufgabe: Ein Buch kostet 8€ und es gibt aktuell nur 5 verschiedene Bände. Beim Kauf von 2 unterschiedlichen Büchern gibt es einen Rabatt von 5%, bei 3 10%, bei 4 20% und bei 5 gibt es 25% auf diese Bücher. Kauft ein Kunden Bücher mehrfach, kosten diese regulär 8€, außer sie ergeben ein neues Rabattset. Sie sollen dem Kunden das günstigste Angebot berechnen.

###Hinweis: Wenn man zum Beispiel 4 Bücher mit 3 unterschiedlichen Titeln kauft, bekommt man 10% für die 3 Bücher die ein Set bilden aber das vierte Buch kostet immernoch 8 EUR.

Eingabe:
2 x Band 1, 2 x Band 2, 2 x Band 3, 1 x Band 4 und 1 x Band 5. Rechnung:
(4 * 8) - 20% [Band 1, Band 2, Band 3, Band 4] + (4 * 8) - 20% [Band 1, Band 2, Band 3, Band 5] = 25.6 * 2 = 51.20
Ausgabe: Das günstigste Angebot für den Kunden ist 51,20€!

Erweiterung: Mittlerweile sind zwei neue Bände erschienen und der Buchhändler möchte weiterhin das alte Rabattsystem behalten aber es soll zusätzlich auch mit einem neuen Rabattsystem funktionieren. 2 Bücher = 5%, 3 Bücher = 10%, 4 Bücher = 15%, 5 = 20%, 6 = 25% und 7 = 30%.

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.