Is possible it could be both the battery and the alternator.  A bad battery can over work an alternator and a bad alternator may not properly maintain a charge on a battery. Automotive batteries are not designed to be left in a state of discharge for any extended period of time.  If they are than their lifespan can be greatly reduced.

If you just put a battery in it have the alternator checked.  If it is bad or intermittantly charging you may run for a day or two before you have the same no start problem again. Get the alternator hot before you have it checked. That is when it is most likely not to charge if it is and intermittant problem.  DO NOT unhook  the battery while the car is running the check the alternator.  The voltage spike that this causes can damage other electronic components on your vehicle and the spark that happens from the disconnect and connect can cause the battery to explode.

If your battery is anywhere near 4 years old than just replace it.  Even if it has the super duper latest and greatest never crap out  or your money back warranty.  That warranty slip in your glove box will be good reading material while you are sitting in a parking lot waiting for a jump or tow truck as you are running late to wherever  it is you need to be.

And of course when this happens you will have a gallon of  ice cream in the back of the car.  Eat this (with a smile of course) while  your warranty slip advises you that it does not cover the cost of tow bills incurred if your "Super Duty Mega Volt" battery should happen to fail.