"We need a carpet."
Translation:Wir brauchen einen Teppich.
Because "Teppich" is masculine, not neuter, and because it is a direct object in this case (meaning something is happening to it, not it doing something).
But nothing's happening to the carpet. We're not even buying a carpet, we just have a general need for one.
This is a good question. I think the best way to recognize weather it's a direct object is to see what is happening to it. You can normally recognize this by the word just right or a few words before. We need the Teppich. What are we doing. Well let's take another look 'We need the Teppich' Now you see that what we're doing is 'needing' it. Normally these can be replaced with other ones 'we want the Teppich' 'We kill the Teppich'. So really it's all about the verb.
To be easier, i think we could say it is a direct object by understanding that 'we need the carpet', not 'the carpet needs us' It's an indirect object for the second one right?
Not much. It's a bit like "require" and "need".
So it's "Wir haben einen Teppich" because "Teppich" is the direct object. But the sentence before was "Das is ein Teppich". Isn't Teppich the direct object of that sentence too? "Ein" was listed as correct there.
No, there is no direct object in the sentence Das ist ein Teppich.
"to be" is not a transitive verb that takes a direct object; it's a copula (linking verb) that links a subject to a predicate that says something about that subject.
In German, such predicates are in the nominative case.
A carpet. Like you might go to warehouse and buy a Persian carpet -- bigger than a rug but still one single item; not like wall-to-wall carpeting.