Python Help

Tsar Agus

WhiteOnmyoji

Python Help

August 22 2013
Hey all, I am in serious need of help, I am failing my first class since I took Algebra 2 in the 7th Grade.

I am a complete programming idiot and I am desperately needing help with my 2 python programming finals.

This is the first:
For this assignment you will re-work your simple simple contact manager application. This application will track personal information about the user's friends and acquaintances. The user will be able to enter information for new contacts and also lookup information for a contact.

For this assignment you will create a simple class hierarchy. You will create an inheritance relationship between two classes -- a Friend class and a Person class - Friend will inherit Person.

Your Person class will have the following attributes:
first_name
last_name
phone_number
Your Friend
email
birth_date

Both your Person class and your Friend class will have a get_info method.
For the Person class, the get_info method will return a string with the full name and phone number of the person.

For the Friend class, the get_info method will return a string with the full name, phone number, email address, and birth date.

The application will present a main menu to the user that will allow the user to add a contact, lookup a contact by name, or exit the application.

When the user chooses to add a contact, the application will ask the user if they want to add a regular person or a friend. If the user wants to add a new regular person contact then the application will ask for the first name, last, name and phone number for that person. If the user wants to add a new friend contact then the application will ask the user for the first name, last name, phone number, email address, and birth date.

When the user chooses to lookup a contact by name, the application will ask the user for the last name, and then the application will display the full information for all contacts with that last name.

(Attached is a code that took me 4 days to do)

the second is also based on the code

The names of all contacts (Last, First) should be displayed in the Contact listbox.

When a name is selected, and the "Display Contact" button is pressed, the full contact information (Full name, phone number for 'person', add email and b-day for 'friend') should be displayed in the "Result" Label. If no person is selected, the button should not do anything.

When a Last name is entered in the "Last Name" box, and the Search button is pressed, the program should find the contact with that last name and display the full contact information in the Result label. If no name is found, "Not found" should be displayed in the Result label.

To add a new contact, the user should fill out at least First Name, Last Name, and Phone #. If the new contact is a friend, the Friend checkbox should be checked, and email and birthday should be included. After this information is added, when the user clicks the "Add Contact" button a new contact is added to the contact list. After the Add Contact Button is pressed, the new contact entry fields should be cleared by the program.

BONUS: 10 extra credit points if you add a "Remove" button that removes selected contacts from the contact list.

I'll just put this out there, first person to really help me out gets 20 Lockbox keys (25 if you get me the bonus points) LOL

I know there's some programming gurus out there and if any one can help I'd greatly appreciate it
Tsar Agus

WhiteOnmyoji

Re: Python Help

August 22 2013
The following tags have no closing tag: i, i
Whoops sorry couldn't upload the file so here it is in text

class Person:
def __init__(self, firstname, lastname, phonenumber):
self.__firstname = firstname
self.__lastname = lastname
self.__phonenumber = phonenumber

def getlastname(self):
return self.__lastname

def get_info(self):
return self.__firstname + " " + self.__lastname + " " + self.__phonenumber

class Friend(Person):
def __init__(self, firstname, lastname, phonenumber, email, birthdate):
super().__init__(firstname, lastname, phonenumber)
self.__email = email
self.__birthdate = birthdate

def get_info(self):
return super().get_info() + " " + self.__email + " " + self.__birthdate

def displayMenu():
print("Main Menu")
print("1: Add a Contact")
print("2: Lookup contact by name")
print("3: Exit")
choice = int(input("Enter your choice: "))
return choice

contacts = []
def main():
choice = displayMenu()
while (choice != 3):
if(choice==1):
print("Press 1 to add a regular contact or press 2 to add a friend")
ch = int(input("Enter your choice: "))
firstname=input("Enter first name: ")
lastname=input("Enter last name: ")
phonenumber=input("Enter phone number: ")
if (ch==2):
email=input("Enter email address: ")
birthdate=input("Enter birthdare: ")
friend=Friend(firstname, lastname, phonenumber, email, birthdate)
contacts.append(friend)
else:
person=Person(firstname, lastname, phonenumber)
contacts.append(person)
elif (choice==2):
last=input("Enter last name to search: ")
for i in range(0, len(contacts)):
if (contacts.getlastname()==last):
info=contacts.get_info()
print(info)
elif (choice==3):
#exit
print("Exit")
else:
print("ERROR:: Invalid option entered. Try again.")
choice = displayMenu()

main()
Aztroz

betazoidhalf

Re: Python Help

August 22 2013
Sensei,

I can take some time to help you after work today. In the mean time, can you reply to the post and elaborate on what specifically you need help on, so I can focus my thoughts when I get home?

Keston
One who at least looks like a computer scientist 8 hours per day ;)
Tsar Agus

WhiteOnmyoji

Re: Python Help

August 22 2013
Lets not pretend I learned anything and just go with the whole damn thing.
Edited August 22 2013 by WhiteOnmyoji
Benjamin Ethier

Sthiss

Re: Python Help

August 24 2013
I got a D- (still a passing grade!) in highschool biology... So I can't help you with your snake presentation.

Re: Python Help

August 24 2013
I would love to help you, but I don't know Python. :(
Jeremy

jerepois

Re: Python Help

September 05 2013
When is the due dates?
Tsar Agus

WhiteOnmyoji

Re: Python Help

September 05 2013
2 weeks ago... :-(
Devin

minicrisp

Re: Python Help

September 05 2013
i thought some one was needing help with there python ? ;)