THINK FIRST·CODE LATER

← All labs

Little's law calculator

Problem

Little's law: WIP = throughput × cycle time. Given any two of the three values, compute the third.

Read lines until the end of input. Each line has a question type and two numbers:

  • CT wip throughput → print Cycle time: X days
  • TP wip cycletime → print Throughput: X cards/day
  • WIP throughput cycletime → print WIP: X cards

Print X with two decimals. If a division by zero would be needed, print Error: division by zero. For an unknown type print Error: unknown query TYPE.

Input:

CT 12 3
TP 10 5
WIP 2 4.5
CT 5 0
XYZ 1 2

Output:

Cycle time: 4.00 days
Throughput: 2.00 cards/day
WIP: 9.00 cards
Error: division by zero
Error: unknown query XYZ

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.