Homework
Homework — your menu with input
YOUR app becomes interactive today — the first of the course's three milestones (runs → holds many → saves).
Requirements:
- A menu loop —
for+switch, repeating until "q". - At least 3 meaningful branches for your theme (e.g. movies: show / set title / mark watched) +
q. - A
defaultbranch for a bad choice — the program never crashes. - Read input correctly. Use
readLine()(bufio.Scanner), notfmt.Scanln, so a multi-word title (e.g. "The Lord of the Rings") is read in full. - A retry loop for number input. Use
readInt(): on "abc", the program asks again instead of crashing or kicking back to the menu. gofmt+ a workinggo run.
Extra (for those who want more): add a "confirm" action — before marking or clearing a record, ask "Are you sure? (y/n)" and read the answer with readLine().
To submit: the code file + a terminal transcript showing: (1) a multi-word title read in full, (2) a bad number rejected with a re-prompt, (3) quitting with "q".
Tip. You now read input correctly — and that stays for the whole course. Next lesson: types in depth. Inside
readInthidesstrconv.Atoi(text → number) — we'll open it up and see how to check bounds, and why190/380can wrongly give 0.