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
1
Merge Requests
1
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
sully.khalifa
eventPlanningSystem
Commits
eef915e0
Commit
eef915e0
authored
Jan 13, 2023
by
zyusuke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
File created
parent
c6257a35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
2 deletions
+174
-2
README.md
README.md
+1
-2
main.py
main.py
+173
-0
No files found.
README.md
View file @
eef915e0
# eventPlanningSystem
# eventPlanningSystem
main.py
0 → 100644
View file @
eef915e0
# Allow users to create multiple events = create a class for <Events>.
#Events attributes : event_name, a name of an organiser, event_description, an array for invited people.
#track whether or not each invitee has RSVP, whether or not if they are bringing a plus one.
# + track whether they have any dietary or other requirements
#create a class for <invitee> ?
#Inviteee attributes : name, gender, plusOne(boolean), dietary / requirements, meals?
#Create a class for <set meal>
#set meal attributes : meal name etc
from
abc
import
ABC
,
abstractmethod
class
SetMeal
(
ABC
):
@
abstractmethod
def
get_drink
(
self
):
pass
@
abstractmethod
def
get_starter
(
self
):
pass
@
abstractmethod
def
get_main
(
self
):
pass
@
abstractmethod
def
get_desert
(
self
):
pass
class
Invitee
(
ABC
):
def
__init__
(
self
,
name
,
age
,
gender
):
self
.
name
=
name
self
.
age
=
age
self
.
gender
=
gender
self
.
plusOne
=
False
self
.
plusOne_name
=
""
self
.
dietary_requirements
=
False
@
abstractmethod
def
set_plus_one
(
self
):
pass
@
abstractmethod
def
set_dietary_requirements
(
self
):
pass
class
Rich_Invitee
(
Invitee
):
def
set_plus_one
(
self
,
name
):
self
.
plusOne
=
True
self
.
plusOne_name
=
name
print
(
"Im Rich"
)
def
set_dietary_requirements
(
self
):
self
.
dietary_requirements
=
True
class
Standard_Invitee
(
Invitee
):
def
set_plus_one
(
self
,
name
):
self
.
plusOne
=
True
self
.
plusOne_name
=
name
def
set_dietary_requirements
(
self
):
self
.
dietary_requirements
=
True
class
StandardSetMeal
(
SetMeal
):
def
get_drink
(
self
):
print
(
"Coke"
)
#Print out a name of the drink here
def
get_starter
(
self
):
print
(
"Chips"
)
#Print out a name of the starter here
def
get_main
(
self
):
print
(
"Cheese Burger"
)
#print out a name of the main here
def
get_desert
(
self
):
print
(
"Pudding"
)
#print out a name of the desert here
class
LuxurySetMeal
(
SetMeal
):
def
get_drink
(
self
):
print
(
"Wine"
)
#Print out a name of the drink here
def
get_starter
(
self
):
print
(
"Caesar Salad"
)
#Print out a name of the starter here
def
get_main
(
self
):
print
(
"Sirloin Steak"
)
#print out a name of the main here
def
get_desert
(
self
):
print
(
"Creme Brulee"
)
#print out a name of the desert here
class
EventFactory
(
ABC
):
def
__init__
(
self
,
title
,
organizer
,
description
):
self
.
title
=
title
self
.
organizer
=
organizer
self
.
description
=
description
self
.
invitees
=
[]
@
abstractmethod
def
get_set_meal
(
self
):
pass
@
abstractmethod
def
get_invitee
(
self
):
pass
@
staticmethod
def
add_invitee
(
self
,
name
):
self
.
invitees
.
append
(
name
)
class
ExpensiveEventFactory
(
EventFactory
):
def
get_set_meal
(
self
)
->
SetMeal
:
return
LuxurySetMeal
()
def
get_invitee
(
self
,
name
,
age
,
gender
)
->
Invitee
:
self
.
invitees
.
append
(
name
)
return
Rich_Invitee
(
name
,
age
,
gender
)
def
add_invitee
(
name
):
EventFactory
.
add_invitee
(
name
)
class
CheapEventFactory
(
EventFactory
):
def
get_set_meal
(
self
)
->
SetMeal
:
return
StandardSetMeal
()
def
get_invitee
(
self
,
name
,
age
,
gender
)
->
Invitee
:
self
.
invitees
.
append
(
name
)
return
Standard_Invitee
(
name
,
age
,
gender
)
def
add_invitee
(
name
):
EventFactory
.
add_invitee
(
name
)
#------------What users can do ----------------------------------------------------
def
createEvent
(
event_type
:
str
,
title
,
organizer
,
description
):
factories
=
{
"Expensive"
:
ExpensiveEventFactory
(
title
,
organizer
,
description
),
"Cheap"
:
CheapEventFactory
(
title
,
organizer
,
description
)
}
event
=
factories
[
event_type
]
return
event
def
select_Meal
(
meal_type
:
str
):
meals
=
{
"Standard"
:
StandardSetMeal
(),
"Luxury"
:
LuxurySetMeal
()
}
set_meal
=
meals
[
meal_type
]
return
set_meal
def
invite
(
person_type
:
str
,
name
,
age
,
gender
):
invitee_type
=
{
"Rich"
:
Rich_Invitee
(
name
,
age
,
gender
),
"Standard"
:
Standard_Invitee
(
name
,
age
,
gender
)
}
invitee
=
invitee_type
[
person_type
]
return
invitee
\ No newline at end of file
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