Guild Account (Structs & Classes)

Model an Account with a balance. Read the starting balance, then n operations deposit x or withdraw x. A withdrawal larger than the balance prints denied and is skipped. Finally print the balance.

Input: Start balance, n, then n operation lines.

Output: denied for each refused withdrawal, then the final balance.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Give the Account deposit and withdraw methods.

More Structs & Classes practice