Skip to content

LagosScala/checkout-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Checkout System

Please complete the following exercise. Don't read ahead. At each stage build the simplest implementation which meets the requirement. Rather than looking stuff up, feel free to ask your partner for help.

Step 1: Shopping cart

You are building a checkout system for a shop which only sells apples and oranges.

Apples cost 60p and oranges cost 25p.

Build a checkout system which takes a list of items scanned at the till and outputs the total cost

For example: [ Apple, Apple, Orange, Apple ] => £2.05

Make reasonable assumptions about the inputs to your solution; for example, many candidates take a list of strings as input

Step 2: Simple offers

The shop decides to introduce two new offers

Buy one, get one free on Apples

3 for the price of 2 on Oranges

Update your checkout functions accordingly

Step 3: More complicated offers

The shop adds Bananas which cost 20p

Bananas are added to the same buy one, get one free offer as apples

The cheapest item should be given free first

Update your checkout

Step 4: Even more complicated offers

The shop adds melons which cost £1

Melons are available through a separate 3 for 2 offer

Update your checkout

Step 5: Real time checkout

Customers complain that they do not know how much their shopping costs until all produce are scanned

Re-implement your checkout to show a running total as items are scanned.

Stretch Goal: Cheapest baskets

Customers notice that they could save money by making multiple trips to the checkout. Why?

Update the checkout so that customers get the lower price for only one trip

About

Scala, lagos, Yaba

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published