Interfaces, traits, and type classes

F-IFACE-V4-3hard

Count each room once

A hotel bill applies room discounts, accepts coupons and counts the rooms booked.

What needs to change

Repair distinctRooms so each room is counted once.

Reproduce

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

Acceptance criteria

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

Notes

The file contains its imports, readLines, the Booking type and the complete main.

Input: up to 100 whitespace-delimited "room price" bookings. Room IDs are decimal numbers from 0 to 9999 and prices from 0 to 100, with leading zeros allowed. Repeated numeric IDs denote one room; every booking contributes revenue. The supplied reader receives valid fields.

Sign in to open this exercise

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

Sign in