Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eventPlanningSystem
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
essie.lee
eventPlanningSystem
Commits
36fe268e
Commit
36fe268e
authored
Jan 15, 2023
by
sully.khalifa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit branch version 0.3
parent
58659a48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
64 deletions
+157
-64
eventPage.py
eventPage.py
+0
-33
eventPage2.py
eventPage2.py
+0
-31
event_planning_system.py
event_planning_system.py
+157
-0
No files found.
eventPage.py
deleted
100644 → 0
View file @
58659a48
class
Student
:
def
__init__
(
self
,
name
,
age
,
grade
):
self
.
name
=
name
self
.
age
=
age
self
.
grade
=
grade
# 0 - 100
def
get_grade
(
self
):
return
self
.
grade
class
Course
:
def
__init__
(
self
,
name
,
max_students
):
self
.
name
=
name
self
.
max_students
=
max_students
self
.
students
=
[]
def
add_students
(
self
,
student
):
if
len
(
self
.
students
)
<
self
.
max_students
:
self
.
students
.
append
(
student
)
return
True
return
False
def
get_average_grade
(
self
):
pass
s1
=
Student
(
"Tim"
,
19
,
25
)
s2
=
Student
(
"Bill"
,
19
,
75
)
s3
=
Student
(
"Jill"
,
19
,
65
)
course
=
Course
(
"Science"
,
2
)
course
.
add_students
(
s1
)
course
.
add_students
(
s2
)
print
(
course
.
students
[
0
]
.
name
)
\ No newline at end of file
eventPage2.py
deleted
100644 → 0
View file @
58659a48
class
Events
:
def
__init__
(
self
,
name
,
organiser
,
description
):
self
.
name
=
name
self
.
organiser
=
organiser
self
.
description
=
description
# describing the event
def
get_name
(
self
):
return
self
.
name
class
Invitees
:
def
__init__
(
self
,
name
,
plus_one
,
max_invitees
):
self
.
name
=
name
self
.
plus_one
=
plus_one
self
.
max_invitees
=
max_invitees
self
.
events
=
[]
def
add_invitees
(
self
,
name
):
if
len
(
self
.
events
)
<
self
.
max_invitees
:
self
.
events
.
append
(
event
)
return
True
return
False
def
get_average_grade
(
self
):
pass
event1
=
Events
(
"Testing"
,
"Jack"
,
"first edition"
)
event2
=
Events
(
"Release"
,
"John"
,
"Main release"
)
event_planning_system.py
0 → 100644
View file @
36fe268e
'''The Event class has a name, organizer, and description,
and it also has a list of invitees and a menu. The class has
methods to add invitees and view the list of invitees.'''
class
Event
:
def
__init__
(
self
,
name
,
organizer
,
description
):
self
.
name
=
name
self
.
organizer
=
organizer
self
.
description
=
description
self
.
invitees
=
[]
self
.
menu
=
Menu
()
def
add_invitee
(
self
,
invitee
):
self
.
invitees
.
append
(
invitee
)
def
view_invitees
(
self
):
for
invitee
in
self
.
invitees
:
print
(
invitee
)
'''The Invitee class has a name, RSVP status, whether or not
they are bringing a plus one, and any dietary requirements.
The class has a __str__ method that formats the
invitee's information into a human-readable string.'''
class
Invitee
:
def
__init__
(
self
,
name
,
rsvp
=
False
,
plus_one
=
False
,
dietary_req
=
None
):
self
.
name
=
name
self
.
rsvp
=
rsvp
self
.
plus_one
=
plus_one
self
.
dietary_req
=
dietary_req
def
__str__
(
self
):
return
f
"Name: {self.name}, RSVP: {'Yes' if self.rsvp else 'No'}, Plus One: {'Yes' if self.plus_one else 'No'}, Dietary Requirements: {self.dietary_req}"
'''The Menu class has a dictionary of items, where each
item is a meal and the value is a list of invitees.
The class has methods to add items and view the menu.'''
class
Menu
:
def
__init__
(
self
):
self
.
items
=
{}
def
add_item
(
self
,
meal
,
invitees
):
self
.
items
[
meal
]
=
invitees
def
view_menu
(
self
):
for
meal
,
invitees
in
self
.
items
.
items
():
print
(
f
"{meal}: {', '.join(invitees)}"
)
'''The EventFactory class has methods to create events and invitees.'''
class
EventFactory
:
def
create_event
(
self
,
name
,
organizer
,
description
):
return
Event
(
name
,
organizer
,
description
)
def
create_invitee
(
self
,
name
,
rsvp
=
False
,
plus_one
=
False
,
dietary_req
=
None
):
return
Invitee
(
name
,
rsvp
,
plus_one
,
dietary_req
)
'''The EventView class has methods to create events,
add invitees, view the list of invitees, add menu items,
and view the menu. The class uses an EventFactory
object to create events and invitees.'''
class
EventView
:
def
__init__
(
self
,
event_factory
):
self
.
event_factory
=
event_factory
self
.
events
=
[]
def
create_event
(
self
):
name
=
input
(
"Enter event name: "
)
organizer
=
input
(
"Enter organizer name: "
)
description
=
input
(
"Enter event description: "
)
event
=
self
.
event_factory
.
create_event
(
name
,
organizer
,
description
)
self
.
events
.
append
(
event
)
print
(
f
"Event {name} created successfully!"
)
def
add_invitee
(
self
):
event_name
=
input
(
"Enter event name: "
)
event
=
next
((
x
for
x
in
self
.
events
if
x
.
name
==
event_name
),
None
)
if
event
:
name
=
input
(
"Enter invitee name: "
)
rsvp
=
input
(
"Has invitee RSVPd? (y/n)"
)
.
lower
()
==
"y"
plus_one
=
input
(
"Is invitee bringing a plus one? (y/n)"
)
.
lower
()
==
"y"
dietary_req
=
input
(
"Enter invitee dietary requirements: "
)
invitee
=
self
.
event_factory
.
create_invitee
(
name
,
rsvp
,
plus_one
,
dietary_req
)
event
.
add_invitee
(
invitee
)
print
(
f
"Invitee {name} added to event {event_name}"
)
else
:
print
(
f
"Event {event_name} not found."
)
def
view_invitees
(
self
):
event_name
=
input
(
"Enter event name: "
)
event
=
next
((
x
for
x
in
self
.
events
if
x
.
name
==
event_name
),
None
)
if
event
:
event
.
view_invitees
()
else
:
print
(
f
"Event {event_name} not found."
)
def
add_menu_item
(
self
):
event_name
=
input
(
"Enter event name: "
)
event
=
next
((
x
for
x
in
self
.
events
if
x
.
name
==
event_name
),
None
)
if
event
:
meal
=
input
(
"Enter meal name: "
)
invitees
=
input
(
"Enter invitees (comma separated): "
)
.
split
(
","
)
event
.
menu
.
add_item
(
meal
,
invitees
)
print
(
f
"Meal {meal} added to event {event_name}"
)
else
:
print
(
f
"Event {event_name} not found."
)
def
view_menu
(
self
):
event_name
=
input
(
"Enter event name: "
)
event
=
next
((
x
for
x
in
self
.
events
if
x
.
name
==
event_name
),
None
)
if
event
:
event
.
menu
.
view_menu
()
else
:
print
(
f
"Event {event_name} not found."
)
def
search_invitee
(
self
):
invitee_name
=
input
(
"Enter invitee name: "
)
for
event
in
self
.
events
:
invitee
=
next
((
x
for
x
in
event
.
invitees
if
x
.
name
==
invitee_name
),
None
)
if
invitee
:
print
(
f
"Invitee {invitee_name} found in event {event.name}"
)
print
(
f
"RSVP: {invitee.rsvp}"
)
print
(
f
"Plus One: {invitee.plus_one}"
)
print
(
f
"Dietary Requirements: {invitee.dietary_req}"
)
return
print
(
f
"Invitee {invitee_name} not found."
)
def
main
():
event_factory
=
EventFactory
()
event_view
=
EventView
(
event_factory
)
while
True
:
print
(
"1. Create Event"
)
print
(
"2. Add Invitee"
)
print
(
"3. View Invitees"
)
print
(
"4. Add Menu Item"
)
print
(
"5. View Menu"
)
print
(
"6. Search Invitee"
)
print
(
"7. Exit"
)
choice
=
input
(
"Enter your choice: "
)
if
choice
==
"1"
:
event_view
.
create_event
()
elif
choice
==
"2"
:
event_view
.
add_invitee
()
elif
choice
==
"3"
:
event_view
.
view_invitees
()
elif
choice
==
"4"
:
event_view
.
add_menu_item
()
elif
choice
==
"5"
:
event_view
.
view_menu
()
elif
choice
==
"6"
:
event_view
.
search_invitee
()
elif
choice
==
"7"
:
break
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment