Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions class.py
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions code1.py
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions getters.py
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Contact:
__firstName = ""
__lastName = ""
__phoneNumber = 0
__email = ""
11 changes: 11 additions & 0 deletions setters.py
Original file line number Diff line number Diff line change
@@ -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