Go struct embedding and promoted methods

F-EMBED-V4-2medium

Share the coach

The reservation quote uses the board’s daily price for guests and a member price of 80 percent rounded down before multiplying by days. Team bookings must accumulate into the one coach supplied to all teams. The directory card shows a sponsor’s name and amount when present, or no sponsor when the embedded pointer is nil.

What needs to change

Repair Team and newTeams so the coach’s hours include every team’s bookings.

Reproduce

  1. Pipe the sample bookings into go run main.go and compare the hours line.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its imports, readLines, Coach with its Book method and the complete main.

Input: up to 50 whitespace-delimited "team hours" bookings, with decimal whole hours 0..100. Team names are opaque tokens and may repeat; leading zeros in hours denote decimal values. The supplied reader receives valid data.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in