Question: how do you know if it is the battery or alternator?
Answer: A simple test to check the working of the alternator is by running your car; and then unplugging the positive connection of the battery. If the car stops, then you most likely have a problem with the alternator. Another simple test is to check your interior lights.