You are an architect who needs to decide how to position fou

You are an architect who needs to decide how to position four new shops in a mall: a Japanese restaurant, a hairstylist, a clothing store, and a toy store. The floor plan can be represented as 3 times 3 grid (three rows 0, 1, 2 and three columns 0, 1, 2) and you need to place each shop in one cell of the grid (row, column). Marketing research has generated the following constraints on how to position the shops. Note that establishments are considered close to each other if they share an edge on the grid. There is a fish and chips stand in cell (2, 2). There is a health store in cell (1, 0). The hairstylist and the clothing store should not be close to the fish and chips stand The Japanese restaurant should be close to the health store. The hairstylist and the clothing store should be close to the Japanese restaurant The hairstylist and the clothing store should not be close to the toy store Represent this problem as a CSP. Be as precise as you can in specifying the constraints. Also do not forget some basic constraints that are inherent in allocating objects in space but are not listed above.

Solution

class Team:
members = {}
member = \"\"
phone = \"\"
jersey = 0

def __init__(self, member, phone, jersey):
self.member = member
self.phone = phone
self.jersey = jersey

def setmember(self, member):
self.member = member

def setphone(self, phone):
self.phone = phone

def setjersey(self, jersey):
self.jersey = jersey

def getmember(self, member):
return self.member

def getphone(self, phone):
return self.phone

def getjersey(self, jersey):
return self.jersey

def displayData(self):
print(\"Name : \", self.member)
print(\"Phone Number : \", self.phone)
print(\"Jersey Number : \", self.jersey)

def displayMenu():
print(\"===========Main Menu===========\")
print(\"1. Display Members.\")
print(\"2. Add member\")
print(\"3. Remove member\")
print(\"4. Edit member\")
print(\"5. Save data.\")
print(\"6. Load data.\")
print(\"7. Exit Program\")
return int(input(\"Selection> \"))

def printmember(members):
if len(members) == 0:
print(\"No current members\")
else:
for x in members.keys():
members[x].diaplydata()

def addmember(members):
newMember = input(\"Enter Members Name : \")
newPhone = int(input(\"Phone Number : \"))
newJersey = int(input(\"Jersey Number : \"))
members[newMember] = (newMember, newPhone, newJersey)
print(\"Member has been added\")
return members

def removemember(members):
removemember = input(\"Please Enter Member to be Removed : \")
if removemember in members:
del members[removemember]
print(\"Member removed\")
else:
print(\"Member not found.\")
return members

def editmember(members):
oldmember = input(\"Enter the name of the member you want to edit: \")
if oldmember in members:
newmember = input(\"Enter the members new name : \")
newphone = int(input(\"Please enter new phone number : \"))
newjersey = input(\"Please enter new Jersey number : \")
members[newmember] = (newmember, newphone, newjersey)
print(\"Member edited\")
else:
print(\"Member not found\")
return members

def saveData(members):
filename = input(\"Filename to save: \")
print(\" Saving file....\")
outFile = open(\"/Users/Randy/Desktop/PYCHARM/Week 6/roster.txt\", \"wt\")
for x in members.keys():
member = members[x].getmember()
phone = members[x].getphone()
jersey = members[x].getjersey()
outFile.write(\"member\ , phone\ , jersey\")
print(\"File saved.\")
outFile.close()
return members

def loadData():
members = {}
filename = input(\"Filename to load: \")
inFile = open(\"/Users/Randy/Desktop/PYCHARM/Week 6/roster.txt\", \"rt\")
print(\"Loadng file...\")
while True:
inLine = inFile.readline()
if not inLine:
break
inLine = inLine[:-1]
member, phone, jersey = inLine.split(\",\")
members[member] = Team(member, phone, jersey)
print(\"File loaded!\")
inFile.close()
return members

print(\"Welcome to Feathers Team Manager\")
menuSelection = displayMenu()
choice = 1
while choice:
if menuSelection == 1:
printmember(members)
elif menuSelection == 2:
members = addmember(members)
elif menuSelection == 3:
members = removemember(members)
elif menuSelection == 4:
members = editmember(members)
elif menuSelection == 5:
members = saveData(members)
elif menuSelection == 6:
members = loadData(members)
elif menuSelection == 7:
print(\"Goodbye!\")
exit()
menuSelection = displayMenu()

 You are an architect who needs to decide how to position four new shops in a mall: a Japanese restaurant, a hairstylist, a clothing store, and a toy store. The
 You are an architect who needs to decide how to position four new shops in a mall: a Japanese restaurant, a hairstylist, a clothing store, and a toy store. The
 You are an architect who needs to decide how to position four new shops in a mall: a Japanese restaurant, a hairstylist, a clothing store, and a toy store. The

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site