A capacitor is a type of electrical reservoir that stores and releases electric energy. This…