Vending Machine State Controller

Medium Applied OOP Mini Projects
Solve in Playground →

Problem Statement

Model a `VendingMachine` (balance, price). Accept deposit commands (DEPOSIT x), purchase (BUY), or refund (REFUND). Print remaining balance or item status.

Input Format

Line 1: item price P. Line 2: N commands.

Output Format

Print final balance float or DISPENSED/REFUNDED text.

Constraints

P > 0, N >= 1

Sample Input

2.00
3
DEPOSIT 1.00
DEPOSIT 1.00
BUY

Sample Output

DISPENSED

Explanation

Deposited 2.00 matches price 2.00, item is dispensed.

Starter Code

class VendingMachine:
    pass

if __name__ == '__main__':
    # Implement I/O logic here
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used