People will always have an attitude, lol. Sometimes that attitude is positive and other times that attitude is negative. There are people who know how to isolate their negative attidue from school, work, and interpersonal relationships. But it's tough to do, and doesn't come easy to everyone.
Regardless of what one's problems are in life....it's no excuse to take out your negative attitude on someone else. It can potentially destroy relationships. And if you are interacting with someone who you see has a bad attitude, try calmly saying to them,** "I am sensing from your tone and body language that you are upset. We can have a more constructive conversation when you're feeling better. ** And if you need to talk to someone, perhaps I can help." And then leave the person alone.
Or you can say, "It seems to me that you are bothered about something and I hope you resolve your issues soon. Unfotunately, at the moment, I can't continue a conversation with you because I don't appreciate being disrespected."
It's hard to stay calm when someone is giving you an attitude. And we've all been on the giving and receiving end of this scenario. But if you put up with it for a long time.....it won't help anything. Calling the person on their attitude in a calm way, could lead them to reflect on their behavior.