Code Room
Vibe codingHardvc-g195
Subject Ai prompt specLevel Senior–Staff~20 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

You're asking an AI agent to implement a Java function that splits an invoice total across N line items proportionally and applies a percentage tax, returning amounts to charge a customer's card. Write the spec that makes it monetarily correct and auditable. What numeric type, rounding mode, and invariants do you require, and what acceptance criteria prove it? Then describe what a naive prompt ('split the total and add tax') produces that fails an accountant's audit.

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.