In a small classroom, the teacher has two types of boxes. One type of box holds 4 books, and the other type holds 6 books. The total number of boxes is 8, and together they hold a total of 40 books. How many of each type of box does the teacher have?
If we let x be the number of boxes that hold 4 books and y be the number of boxes that hold 6 books, we can set up the following equations:
$x + y = 8$
$4x + 6y = 40$
How many boxes of each type does the teacher have?