Be aware that unlike other parts of the country unless you pay thru the NOSE you will NOT find a hotel with direct beach front access. It just doesn't happen on Cape Cod, there are NO soaring sky scraper type hotels or condo units with beach front access. For the most part, only the really high end resorts have direct beach front access. IF you can find one, even the cheap and cheasy hotels that have direct beach front access are very pricey for what you are getting especially compared to what you find in a place like Ocean City or Rehoboth Beach.
Even while not direct access most of the hotels are nice, but like most resorts overpriced for what you get.
Martha's Vineyard, again, while very nice is very very pricey be it hotel, cottage, house or B&B and unless you are set on going there I'd go for the cape itself and make MV a day trip.
I second Lindsmom, the outer cape is where my family prefers to go - we love Eastham and it's proximity to the National Seashore and P-Town. Also love being able to watch the sunrise over the ocean in the morning and drive across town to watch it set over the ocean in the evening - this is actually a thing that many people do down there. Areas like Hyannis are more developed, but still don't come near to the development that you will find in more southern beach towns.
If you are planning on staying a full week, I strongly recommend renting a cottage/house. In contrast to southern beach locales most of the rental units on the Cape are not palatial and are set up to accomodate single families not huge groups so it's very possible to get a place right on the beach, and less expensively a place very close to the beach (walking distance is considered 1/4 mile or less). VRBO has a good selection of cottages, but I also recommend checking out local realtors as VRBO doesn't have as huge a catalog on the cape as you will find as if you were renting on say the OBX. Most realtors have great selection of cottages/houses and the added on rental fees are usually very reasonable (@$50 plus cleaning and sec deposit is what we've usually paid).
ETA - I noticed that you are planning on visiting in June - I'd strongly recommend going later in the month as opposed to earlier in the month; Although the beaches will be empty during the week early in the month (Elementary and High Schools here let out mid to late June - my kids get out the 16th), the water will be so cold you won't be able to enjoy it. We've gone in early August and had water temps in the high 50s. If you do plan on arriving in early June I'd plan for south coast. MV will still be extremely cold thru June too. Also, you may want to avoid Chatham. In recent years, especially in June, they've had to close the beaches because of Great White sharks, which are there to get the seals (makes for a fun day trip on a boat though!)