THINK FIRST·CODE LATER

← All labs

Write the prompt, then the verification plan

Problem

You will ask an AI assistant to implement StudyBuddy's study-partner matching method. Before you do:

  1. Write the prompt as a mini-specification (context, signature, rules, edge cases, constraints, examples with expected output, request for assumptions). The rules: students match if they share at least one course and have at least one free slot on the same day overlapping by at least 30 minutes; exclude the requesting student; order by total overlap (descending), then by name; slots that only touch (e.g., 19:00–20:00 and 20:00–21:00) do not count. Java 8, no new libraries.
  2. Write a verification plan for whatever code comes back: at least 8 test cases (input → expected result) derived from the rules — not from the code — and four review checks specific to AI-generated code.
  3. Explain in two sentences why you write the tests before seeing the generated code.

Work it out on paper, in a document or here, then compare with the model answer. Your answer stays in your browser — it is never sent to or stored on the server.