File tree 2 files changed +123
-0
lines changed
2 files changed +123
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Homework for week 1
2
+
3
+ 1 ) Create a GitHub account
4
+ 2 ) Come up with your very own project idea that you will build throughout the course (you can change this afterwards)
5
+ 3 ) Create at least 3 different classes and several instances for these classes for your projects
6
+ 4 ) create at least 2 different interactions between said classes
7
+
8
+ ## Examples
9
+ ### Food delivery service
10
+ #### Classes
11
+ - Restaurant
12
+ - Driver
13
+ - Customer
14
+ - Food
15
+
16
+ #### Interactions
17
+ - a Restaurant has a lot of Food that the Customer can order
18
+ - a Customer can order Food
19
+ - the Driver picks up the Food’s from the Restaurant and delivers it to the Customer
20
+
21
+
22
+ ### Twitter clone
23
+ #### Classes
24
+ - Tweet
25
+ - User
26
+ - Like
27
+
28
+ #### Interactions
29
+ - a User has many Tweets and can create new Tweets
30
+ - a User can like a Tweet by creating a Like
31
+ - each Like has one User and one Tweet
32
+ - a Tweet can have many Likes
33
+ - a User can have many Likes
34
+
35
+ this example could also be interpreted as an Instagram clone!
Original file line number Diff line number Diff line change
1
+ /*
2
+
3
+ Code Armagan has written in the lecture
4
+
5
+ */
6
+
7
+ var three = 3
8
+ var five = 5
9
+ var six = 6
10
+
11
+ three + five
12
+ three + six
13
+
14
+ function add ( op1 , op2 ) {
15
+ return op1 + op2
16
+ }
17
+
18
+ add ( 2456.3 , - 912.3 )
19
+
20
+ function subtract ( operand1 , operand2 ) {
21
+ return operand1 - operand2
22
+ }
23
+
24
+ subtract ( 0 , 15 )
25
+
26
+ var multiplication = ( op1 , op2 ) => op1 * op2
27
+ multiplication ( 5 , 3 )
28
+
29
+ var armagan = {
30
+ name : 'Armagan' ,
31
+ age : 34
32
+ }
33
+
34
+ var anna = {
35
+ name : 'Anna' ,
36
+ age : 30
37
+ }
38
+
39
+ var omar = {
40
+ name : 'Omar' ,
41
+ surname : 'Aguinaga'
42
+ }
43
+
44
+ // console.log(armagan)
45
+ // console.log(anna)
46
+
47
+ var Person = class {
48
+ constructor ( name , age ) {
49
+ this . name = name
50
+ this . age = age
51
+ }
52
+
53
+ sayName ( ) {
54
+ console . log ( 'My name is' + this . name )
55
+ }
56
+
57
+ sayAge ( ) {
58
+ return this . age
59
+ }
60
+
61
+ attend ( meetup ) {
62
+ this . meetup = meetup
63
+ meetup . attendees = this . name
64
+ }
65
+ }
66
+
67
+ var armagan = new Person ( 'Armagan' , 34 )
68
+ var omar = new Person ( 'Omar' , 30 )
69
+ // armagan.sayName()
70
+ // omar.sayName()
71
+ // console.log(armagan.sayAge())
72
+ // console.log(omar.sayAge())
73
+
74
+ var Meetup = class {
75
+ constructor ( name ) {
76
+ this . name = name
77
+ this . attendees = null
78
+ }
79
+ }
80
+
81
+ var wtmb = new Meetup ( 'Women TechMakers Berlin' )
82
+ // console.log(wtmb, armagan)
83
+ var anna = new Person ( 'Anna' , 30 )
84
+ armagan . attend ( wtmb )
85
+ omar . attend ( wtmb )
86
+ anna . attend ( wtmb )
87
+
88
+ console . log ( armagan )
You can’t perform that action at this time.
0 commit comments