yamizi / TP1books

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Practical Session of Software Testing

TP1 : Junit Exercise

To complete:

  • Name :
  • Student Id:
  • Email :

Setting

In this practical session, you will code a method to compute the cost of shopping basket and test it using JUnit. To do this, you will fill the cost method in the BookShop class and test it. The test have to be written in the BookShopTest class and use Junit5.

Context

To try and encourage more sales of the first 5 different Harry Potter books they sell, a bookshop has decided to offer discounts of multiple-book purchases.

One copy of any of the five books costs 8 EUR.

If, however, you buy two different books, you get a 7% discount on those two books.

If you buy 3 different books, you get a 14% discount.

If you buy 4 different books, you get a 28% discount.

If you go the whole hog, and buy all 5, you get a huge 35% discount.

Note that if you buy, say, four books, of which 3 are different titles, you get a 14% discount on the 3 that form part of a set, but the fourth book still costs 8 EUR.

Your mission is to write a piece of code to calculate the price of any conceivable shopping basket (containing only Harry Potter books), giving as big a discount as possible.

References of Interest

About


Languages

Language:Java 100.0%