Skip to content

attilakiss84/seriously-assignment-2021-11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seriously Homework Assignment

This is a possible implementation for the following problem:

  • Create a software design for a basic vending machine. Write the specs and desired functionalities. We're interested only in the functional design, not the visual/physical design (no UI is necessary).
  • Use the programming language of your choice to implement the virtual vending machine you designed. Demonstrate your understanding of object-oriented design and good coding practices.
  • Write a command-line test program that allows a user to test your vending machine. The user should be able to see a list of snacks/prices, select a snack, put money into the machine, receive money back, etc.

Q1: Software design

Features of the abstract vending machine should include (considering one pictured here):

  • should have certain number of slots for products
  • each channel / slot has certain fixed-sized depth for products
  • each slot is loaded with a stock of single type of product
  • multiple slots can be loaded with the same type of product
  • vending machine features a single payment method

An abstract product has two basic features:

  • name / description
  • price

A payment process consists of 3 steps:

  1. balance is set, payment initiated
  2. payments made until there is outstanding balance
  3. give back money if balance is negative

In case of a card payment, the last step never happens as only precise payments should be possible. A payment should be either successful or possible to be cancelled in which case the already made payments should be returned.

Q2: Implementation notes

  • Product is defined as an abstract class which the current features do not require, but might have impact with other modules / usecases
  • For simplification reasons, for cash payments, the possible note / coin values were not considered, neither cash in the machine
  • Payment issues (card transaction, etc) were not considered this time

Q3: Command line test UI

Code sample for machine setup can be found in test.py file

Purchase process consists of following steps:

  1. List of available products observed
  2. Choice is made and slot code entered
  3. Payment made / Payment cancelled

Payment conclusion or any error during the process clears the product selection. Purchase can be cancelled by typing "CANCEL". Vending machine is operational as long as it is unplugged. You can unplug the test script by typing CTRL+C. :)

About

Seriously Gaming Data Engineer test assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages