Finding unknown inputs with a booking relation

A theatre booking system uses a logical relation to describe all combinations of values satisfying its stated conditions. Its relation booking⁡(a,c)\operatorname{booking}(a,c) holds when aa is the number of adult tickets, cc is the number of child tickets, and all of these conditions hold:

  • aa and cc are integers from 1 through 9, inclusive.
  • Adult tickets cost $18 each and child tickets cost $12 each.
  • The total ticket price is exactly $180, with no fees or discounts.

The logic engine can query this relation with both ticket counts unknown. Count each distinct ordered pair (a,c)(a,c) once; search order is irrelevant.


Find the number of valid ordered pairs and the largest adult-ticket count among those pairs. Then add the further constraint that exactly 12 tickets were purchased, and find the adult-ticket count for the resulting booking. Give all three answers as whole-number counts, to zero decimal places.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Procedural, Functional, Logical and Object-Oriented Paradigms Questions: