THINK FIRST·CODE LATER

← All labs

MoSCoW release planner

Problem

Plan a release with MoSCoW priorities and a fixed capacity.

Input: first line capacity n; then n lines name priority effort where priority is M, S, C or W and effort is a positive integer (story points). Items are listed in the Product Owner's order.

Rules:

  1. All M items are required. If their total effort exceeds the capacity, print INFEASIBLE: Musts need X points, capacity Y and nothing else.
  2. Then go through the S items in input order and add each one that still fits in the remaining capacity; then the same for C items. An item that does not fit is skipped (later, smaller items may still fit).
  3. W items are never planned.

Output:

Planned: item1(M,8) item2(M,5) item3(S,8) ...
Deferred: itemA(S,13) itemB(C,3) ...
Won't: itemX ...
Used: U/CAPACITY points, Musts: P% of capacity

List items in input order within each line; if a list is empty print nothing after the colon. P is mustEffort * 100 / capacity with integer division. If P > 60, add a final line Warning: Musts exceed 60% of capacity.

Input:

40 6
login M 8
post M 8
search S 8
buddy S 21
emoji C 3
video W 30

Output:

Planned: login(M,8) post(M,8) search(S,8) emoji(C,3)
Deferred: buddy(S,21)
Won't: video
Used: 27/40 points, Musts: 40% of capacity

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.