Casper’s utility function is 3x + y, where x is his consumption of cocoa and y is his consumption of cheese.

Casper’s utility function is 3x + y, where x is his consumption of cocoa and y is his consumption of cheese. If the total cost of x units of cocoa is x squared (x^2), the price of cheese is $2, and Casper’s income is $39, how many units of cocoa will he consume?