Has a doctor done a prostate exam or any imaging of that? A testicle exam? You're on the young side for prostatitis (an inflamed prostate) but are right in the age group for testicular cancer (though it sounds more like prostate than testicles, especially if both hurt, not just one).
Pain in the tip of your penis is often a sign of chronic prostatitis, or CPPS. This is trickier, because finding the cause of this is difficult.
Ask for a referral to a urologist, preferably one who has experience with CPPS. You can google one in your area by searching "your area urologist CPPS", like "New York City urologist CPPS". If you can't find one, go to a teaching hospital - maybe your college has one? Teaching hospitals are usually more current on the latest information.