warum hast du Äpfel nicht?
Why isn't "Warum Sie haben keine Äpfel " correct ?
because in questions verb and subject change their places
Warum is the formal word for wieso?
What do you mean by that? "warum" and "wieso" are synonyms, that has nothing to do with being formal or not.
If you are talking about the "formal you": "Warum/Wieso haben Sie ..." and "Warum/Wieso hast du ..." are both accepted.
What about Wofur? Is that also a synonym or something completely different?
"wofür" (note the "ü") means "for what"