-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOJ.js
151 lines (125 loc) · 5.53 KB
/
OOJ.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
//Solution 1
function Poster(filePath, location) {
this.filePath = filePath
this.location = location
}
//This is what I had originally. I couldn't really get this to work
/*var movies = new Array();
new Array() = ["HiddenFigures.jpg", "KongIsland.jpeg", "Logan.jpg", "johnwick3.jpg", "powerrangers.jpg", "tbe_gallagher.jpg", "legobatmanonesheet.jpg", "whyIhaveTrustIssues.jpg", "theEye.jpeg", "Scream_movie_poster.jpg", "silence_of_the_lambs_ver2.jpg", "mirrors.jpg", "Amityville.jpg", "rambo.jpeg", "expendables2.jpg", "badboyII.jpeg"];
//["HiddenFigures.jpg", "KongIsland.jpeg", "Logan.jpg", "johnwick3.jpg", "powerrangers.jpg", "tbe_gallagher.jpg", "legobatmanonesheet.jpg", "whyIhaveTrustIssues.jpg", "theEye.jpeg", "Scream_movie_poster.jpg", "silence_of_the_lambs_ver2.jpg", "mirrors.jpg", "Amityville.jpg", "rambo.jpeg", "expendables2.jpg", "badboyII.jpeg"];
movies[0]= ("whyIhaveTrustIssues.jpg", "Current")
movies[1]= ("HiddenFigures.jpg", "Current" )
movies[2]= ("johnwick3.jpg", "Current")
movies[3]= ("KongIsland.jpeg", "Current")
movies[4]= ("legobatmanonesheet.jpg", "Current")
movies[5]= ("Logan.jpg", "Current")
movies[6]= ("powerrangers.jpg", "Current")
movies[7]= ("tbe_gallagher.jpg", "Current")
movies[8]= ("theEye.jpeg", "Scary" )
movies[9]= ("Scream_movie_poster.jpg", "Scary")
movies[10]= ("silence_of_the_lambs_ver2.jpg", "Scary")
movies[11]= ("mirrors.jpg", "Scary")
movies[12]= ("Amityville.jpg", "Scary")
movies[13]= ("rambo.jpeg", "Action")
movies[14]= ("expendables2.jpg", "Action")
movies[15]= ("badboyII.jpeg", "Action")*/
var trustIssuesPoster = new Poster ("whyIhaveTrustIssues.jpg", "Current")
var powerrangersPoster = new Poster ("powerrangers.jpg", "Current")
var LoganPoster = new Poster ("Logan.jpg", "Current")
var LegoBatmanPoster = new Poster ("legobatmanonesheet.jpg", "Current")
var KongIslandPoster = new Poster ("KongIsland.jpeg", "Current")
var HiddenFiguresPoster = new Poster ("HiddenFigures.jpg", "Current")
var JohnWick2Poster = new Poster ("johnwick3.jpg", "Current")
var theEyePoster = new Poster ("theEye.jpeg", "Scary" )
var ramboPoster = new Poster ("rambo.jpeg", "Action")
var ScreamPoster = new Poster ("Scream_movie_poster.jpg", "Scary")
var SilencePoster = new Poster ("silence_of_the_lambs_ver2.jpg", "Scary")
var TBE_GallagherPoster = new Poster ("tbe_gallagher.jpg", "Current")
var mirrorsPoster = new Poster ("mirrors.jpg", "Scary")
var expendablesPoster = new Poster ("expendables2.jpg", "Action")
var BadBoys2Poster = new Poster ("badboyII.jpeg", "Action")
var AmityvillePoster = new Poster ("Amityville.jpg", "Scary")
function posterAlbum() {
this.posters = []
}
posterAlbum.prototype.addingPosters =
function(poster) {
this.posters.push(poster)
}
var currentMoviesAlbum = new posterAlbum()
//currentMoviesAlbum.addingPosters(movies[0], movies[1], movies[2], movies[3], movies[4], movies[5], movies[6], movies[7])
currentMoviesAlbum.addingPosters(trustIssuesPoster)
currentMoviesAlbum.addingPosters(powerrangersPoster)
currentMoviesAlbum.addingPosters(LoganPoster)
currentMoviesAlbum.addingPosters(LegoBatmanPoster)
currentMoviesAlbum.addingPosters(KongIslandPoster)
currentMoviesAlbum.addingPosters(HiddenFiguresPoster)
currentMoviesAlbum.addingPosters(JohnWick2Poster)
currentMoviesAlbum.addingPosters(TBE_GallagherPoster)
var scaryMoviesAlbum = new posterAlbum()
//scaryMoviesAlbum.addingPosters(movies[8], movies[9], movies[10], movies[11], movies[12])
scaryMoviesAlbum.addingPosters(ScreamPoster)
scaryMoviesAlbum.addingPosters(SilencePoster)
scaryMoviesAlbum.addingPosters(theEyePoster)
scaryMoviesAlbum.addingPosters(AmityvillePoster)
scaryMoviesAlbum.addingPosters(mirrorsPoster)
var oldActionAlbum = new posterAlbum()
//oldActionAlbum.addingPosters(movies[13], movies[14], movies[15])
oldActionAlbum.addingPosters(ramboPoster)
oldActionAlbum.addingPosters(expendablesPoster)
oldActionAlbum.addingPosters(BadBoys2Poster)
posterAlbum.prototype.getPoster = function(number) {
console.log(this.posters[number])
}
posterAlbum.prototype.listItems = function() {
for(var i = 0; i < this.posters.length; i++){
console.log(this.posters[i]);
}
}
scaryMoviesAlbum.getPoster(3)
oldActionAlbum.getPoster(1)
currentMoviesAlbum.getPoster(3)
;
//Solution 2
function Person(name, age, gender, weight, height){
this.name= name
this.age = age
this.gender = gender
this.weight = weight
this.height = height
}
Student.prototype = Object.create(Person.prototype)
function Student(name, age, gender, weight, height){
Person.call (this, name, age, gender, weight, height)
this.studies = false
}
Person.prototype.displayAllInfo = function(){
return this.name + "," + this.age + "," + this.gender + "," + this.weight + "," this.height + ",";
}
Teacher.prototype = Object.create(Person.prototype)
function Teacher (name, age, gender, weight, height){
Person.call(this, name, age, gender, weight, height)
this.studies = true
}
function Class(subject, level) {
this.subject= subject
this.level = level
}
function School(){
this.person = []
}
School.prototype.addPerson = function(person){
this.person.push(person)
}
var gianCarlos= new Person ("Giancarlos Neuman", 18, "Male", 222,"8ft 1in")
var DinaVegas= new Person ("Dina Vegas", 31, "Female", 111, "5ft 5in")
var VindaLoo= new Person ("Vinda Loo", 6, "Male", 65, "4ft 10in")
var CarlaNoel= new Person ("Carla Noel", 50, "Female", 125, "5ft 10in")
var French= new Class ("French", "AP")
console.log(French);
var school = new School()
school.addPerson(CarlaNoel)
school.addPerson(gianCarlos)
school.addPerson(French)
console.log(CarlaNoel.displayAllInfo())
console.log(gianCarlos.displayAllInfo())