-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathconquest-assignment2.js
234 lines (132 loc) · 4.22 KB
/
conquest-assignment2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// create 10 classes with 5 objects
class Phone{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let google = new Phone("pixel", "7pro", "tensor G2", "120hz", 4000 )
let samsung = new Phone("s23", "ultra", "snapdragon 8", "120hz", 4500 )
class Person{
constructor(name, age, gender, height, gamePlayed){
this.name = name
this.age = age
this.gender = gender
this.height = height
this.gamePlayed = gamePlayed
}
}
let person1 = new Person("pete", 19, "male", 5.9, "hockey" )
let person2 = new Person("micheal", 22, "male", 5.9, "football" )
class Country{
constructor(name, continent, directon, president, race){
this.name = name
this.continent = continent
this.directon = directon
this.president = president
this.race = race
}
}
let countA = new Country("usa", "America", "north", "biden", "white")
let countB = new Country("uganda", "Africa", "east", "museveni", "black")
class Movie{
constructor(name, type, country, time, rate){
this.name = name
this.type = type
this.country = country
this.time = time
this.rate = rate
}
}
let movA = new Movie("ready player one", "film", "usa", 150, 90)
let movB = new Movie("Fargo", "tv", "usa", 170, 91)
class Club{
constructor(name, country, league, table, qualification){
this.name = name
this.country = country
this.league = league
this.table = table
this.qualification = qualification
}
}
let teamA = new Club("chelsea", "england", "EPL", 12, "NO" )
let teamB = new Club("manU", "england", "EPL", 3, "YES" )
class Computer{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let Apple = new Computer("mac", "air", "M2", 120, 10000 )
let PC = new Computer("windows", "surface pro", "Exonus", 90, 12000 )
class Watch{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let watchA = new Watch("pixel", "watch", "tensor", 60, 1200 )
let watchB = new Watch("galaxy", "watch 5", "snapdragon", 60, 1000 )
class Tab{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let Apple1 = new Tab("Ipad", "pro", "A15", "120hz", 6000 )
let samsung1 = new Tab("galaxy", "tab 5", "snapdragon 8", "120hz", 6000 )
class Buds{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let googleA = new Buds("pixel", "buds pro", "tensor", "120hz", 12000 )
let samsungB = new Buds("galaxy", "buds 5", "exynos", "120hz", 12000 )
class Console{
constructor(name, model, chip, display, battery){
this.name = name
this.model = model
this.chip = chip
this.display = display
this.battery = battery
}
}
let consoleA = new Console("playstation", "5", "amd", "120hz", "NONE" )
let consoleB = new Console("xbox", "series X", "intel", "120hz", "NONE" )
// use dot and bracket notation to print 2 properties from each object
console.log(google.model)
console.log(samsung["name"])
console.log(person1.height)
console.log(person2["name"])
console.log(countA.name)
console.log(countB["directon"])
console.log(movA.type)
console.log(movB["country"])
console.log(teamA.league)
console.log(teamB["name"])
console.log(Apple.model)
console.log(PC["name"])
console.log(watchA.model)
console.log(watchB["name"])
console.log(Apple1.model)
console.log(samsung1["name"])
console.log(samsungB.model)
console.log(googleA["name"])
console.log(consoleA.model)
console.log(consoleB["name"])