There is class X.
35X+ 17 = 40(X- 1)+(40-28)
35X+ 17=40X-28
5X=45
X=9
So there are 9 classes, and the number of books =35×9+ 17=332.
Answer; There are 332 books and 9 courses.