Master C++

Box office summary

Box office summary

A small theatre puts one line under each event on its website, saying how many tickets have gone and how much has been taken. Adults and children pay different prices, and both prices are kept in pence.

Write boxOffice. Return the name of the event, a colon, a space, the total number of tickets, the word tickets, a comma, a space, the total taken in pence, and the letter p.

Worked example

Input:  event = "Jazz Night"
        adults = 3,   adultPence = 1200
        children = 2, childPence = 325

3 + 2                = 5 tickets
3 * 1200 + 2 * 325   = 3600 + 650 = 4250 pence

Output: "Jazz Night: 5 tickets, 4250p"

Constraints

  • event is between 0 and 60 characters long.
  • adults and children are each between 0 and 100000.
  • adultPence and childPence are each between 0 and 100000.
  • The wording never changes. A single ticket still reads 1 tickets, and an event that has sold nothing reads 0 tickets, 0p. Fixing that grammar needs a tool you have not met yet.
  • If the event name is empty, the line still starts with the colon: ": 20 tickets, 2980p".
Code

Run your code to see how it does on the examples. Submit also runs the hidden cases.