Alternating-current losses in a two-layer superconducting cable, each layer being composed of 15 closely-spaced rectangular wires made up of second-generation superconductors when the ends of wires are coated by either a non-magnetic or strong ferromagnetic material having a U profile is numerically investigated. Computations are carried out through the finite-element method. The alternating-current losses do not increase significantly if the relative permeability of the coating is increased three orders of magnitude, provided that the current amplitude is less than half of the critical current in a superconducting wire. However, the losses are much higher for ferromagnetic coating if the amplitude of the applied current oscillating at 50 Hz is close to the critical current. The ferromagnetic coating is seen to accumulate the magnetic field lines normally on its surfaces, while the field lines are parallel to the long axes of the wires, leading to more significant flux penetration in the coated regions. This facilitates a uniform low-loss current flow in the uncoated regions of the wires. In contrast, coating with a non-magnetic material gives rise to a considerably smaller current flow in the uncoated regions, whereas the low-loss flow is maintained in the coated regions. Moreover, the current flows in opposite directions in the coated and uncoated regions, where the direction in each region is converse for the two materials.