If you can type 7 pages in 2 hours, then you can type
7/2 pages per hour = 3 1/2 pages/hour.
If your classmate can type 8 pages in 3 hours, then that person can type
8/3 pages per hour = 2 2/3 pages per hour.
The two of you, working independently on two computers, can type
(3 1/2) + (2 2/3) pages per hour = 6 1/6 pages per hour.
37 pages / (6 1/6 pages per hour) = 6 hours.
You would have typed (3 1/2 pages/hour) x (6 hours) = 21 pages.
Your classmate would have typed (2 2/3 pages/hour) x (6 hours) = 16 pages.