Sure, it can be done in Photoshop.
Find a nice image on a stock photography site of a room with tables and chairs, preferably on a plain wooden floor – obviously one without a rug! Pay for a licence to use the image so you won’t be sued.
Something like this perhaps
Then with the Pen Tool, make a vector clipping mask around the table and chair legs. Apply the vector mask to a copy of the image layer.
Paste an image of a rug under the masked layer, turn it into a Smart Object. Use
Distort and move the corners to match the perspective of the room.
If you double click the Smart Object to edit it, you can just paste in another rug, resize it as required, quit and save the Smart Object, and you’ll have a new carpet on the floor.
And here’s the result when you save and close the Smart Object – a new rug!