My brand new desktop will only sometimes connect to the internet? Windows 10?

Okay so I bought this brand new Lenovo computer the other day. I put it up in my room on the 3rd floor. Now up here I have full Wi-Fi connection to my Xbox one and my phone. But the Wi-Fi connections will maybe come up for a little bit on my computer then disappear. Or if a Wi-Fi connection stays, and I connect to it, it either disappears almost immediately or it says no internet access. Now the weird thing is I've gotten it to work twice. The night I brought it home it worked, I had internet and was using it. And yesterday it was working too. But it took forever to get it to work and all I did was keep shutting down the computer and turning it back on. I've tried resetting the router, which is on the first floor of my home (I don't think it would have an affect because I get connection in my Xbox and phone up here?) I've tried uninstalling the wireless adapter thing on the computer and having windows install it manually. I really need it to fully work for school and partially work so somebody please help me! And because of my current living situation, I can only
Have the the computer on this third level and not any closer to the router.

You need to figure out if it's the computer or the network. I'd suggest the easiest thing to do is take your laptop closer to the router and see if it will hold the connection. Also take it someplace with public wi-fi, like Starbucks. If the computer works as you expect in another location, you need to focus on figuring out why it won't work in your room.

If the computer won't hold the connection anywhere, than it's likely something in the hardware and I'd take it back while it's still under warranty.

Sounds like its too far from the router. Try moving it closer for a few minutes and see if the problem goes away