Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Davidyunius #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions oop/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict'

class Robot {
constructor(name, purpose){
this.name = name
this.purpose = purpose
}
}

class RobotFactory{
constructor(){}
static produceRobot(name, qty){
if (name === 'wall-e') {
let produce = new WallE()
for (let x = 0; x < qty; x++) {
console.log(produce.method);
}
}else if (name === 'baymax') {
let produce = new BayMax()
for (let x = 0; x < qty; x++) {
console.log(produce.method);
}
}else if (name === 'autobot') {
let produce = new AutoBot()
for (let x = 0; x < qty; x++) {
console.log(produce.method);
}
}
}
}

class WallE extends Robot{
constructor(){
super('Wall-E')
super.purpose = 'woker'
super.method = 'Wall-E cleans the planet'
}
}

class BayMax extends Robot{
constructor(){
super('BayMax')
super.purpose = 'medic'
super.method = 'Hi, I am BayMax, how may I help you?'
}
}

class AutoBot extends Robot{
constructor(){
super('AutoBot')
super.purpose = 'defender'
super.method = "AutoBot, let's roll!"
}
}

let wall_e = RobotFactory.produceRobot('wall-e', 6);
let baymax = RobotFactory.produceRobot('baymax', 5);
let autobot = RobotFactory.produceRobot('autobot', 3);

// for (var i = 0; i < wall_e.length; i++) {
// wall_e[i].work()
// }

// for (var i = 0; i < baymax.length; i++) {
// baymax[i].heal();
// }

// for (var i = 0; i < autobot.length; i++) {
// autobot[i].defend();
// }
Binary file modified query/database.db
Binary file not shown.
13 changes: 13 additions & 0 deletions query/query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
RELEASE 0

SELECT DISTINCT title, point, level, name, age, gender
FROM players INNER JOIN status
ON players.id = status.playerId order by level desc;
*/

/*
RELEASE 1

SELECT * FROM PLAYERS INNER JOIN CARDS on players.id = cards.playerId where gender='Male' limit 3;
*/
Loading