diff --git a/README.md b/README.md new file mode 100644 index 0000000..25ea5b6 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +This is the semester project For the course Professional Practices In Softeare Development, we have made a simple contact management app to facilitate people about the CLI based interface. The app was made in CLI because the app will be light weight and will be easy to use. +We used Python 3.7 and SQLite as a database. +The app has some simple funtionality like: add a contact, search contact, display all the contacts +There is only one file that should be used to run the code which is main.py +You should have python 3.7 installed in your computer to run this code +There might be some minor bugs diff --git a/class.py b/class.py new file mode 100644 index 0000000..caaa3f8 --- /dev/null +++ b/class.py @@ -0,0 +1,47 @@ +class ContactBook: + __listEnd = 0 + __mycontacts = None + + def __init__(self): + self.__mycontacts=[] + self.__listEnd=0 + + def addcontact(self,first,last,mail,number): + contact = Contact(first,last,mail,number) + __mycontacts[listEnd]=contact + + + def display(self,i): + print("First name: ",self.__mycontacts[i].getfirstname()) + print("Last name: ",self.__mycontacts[i].getlastname()) + print("Email: ",self.__mycontacts[i].getemail()) + print("Phone Number: ",self.__mycontacts[i].getphonenumber()) + + def searchByFirstNameContact(self,__firstName): + i=0 + for i in range (0,listEnd): + if __mycontacts[i].getfirstname()==firstName: + return i + + def searchByLastNameContact(self,__lastName): + i=0 + for i in range (0,listEnd): + if __mycontacts[i].getlastname()==lastName: + return i + + + def searchByEmail(self,__email): + i=0 + for i in range (0,listEnd): + if __mycontacts[i].getemail()==email: + return i + else: + return -1 + + def deleteContact(self,__firstName): + index = searchByFirstNameContact(firstName) + if index==-1: + print("The contact does not exist") + else: + c=Contact + __mycontacts[index] =c diff --git a/code1.py b/code1.py new file mode 100644 index 0000000..19c74dd --- /dev/null +++ b/code1.py @@ -0,0 +1,11 @@ +def __init__(self): + self.__firstName = "" + self.__lastName = "" + self.__phoneNumber = 0 + self.__email = "" + + def __init__(self,first,last,mail,num): + self.__firstName=first + self.__lastName=last + self.__email=mail + self.__phonenumber=num \ No newline at end of file diff --git a/getters.py b/getters.py new file mode 100644 index 0000000..f45e746 --- /dev/null +++ b/getters.py @@ -0,0 +1,11 @@ + def getfirstname(self): + return self.__firstName + + def getlastname(self): + return self.__lastName + + def getemail(self): + return self.__email + + def getphonenumber(self): + return self.__phonenumber diff --git a/main.py b/main.py new file mode 100644 index 0000000..5624e21 --- /dev/null +++ b/main.py @@ -0,0 +1,5 @@ +class Contact: + __firstName = "" + __lastName = "" + __phoneNumber = 0 + __email = "" diff --git a/setters.py b/setters.py new file mode 100644 index 0000000..4308bbc --- /dev/null +++ b/setters.py @@ -0,0 +1,11 @@ + def setfirstname(self,first): + self.__firstName=first + + def setlastname(self,last): + self.__lastName=last + + def setEmail(self,mail): + self.__email=mail + + def setphonenumber(self,num): + self.__phonenumber=num