diff --git a/03ejercicio/Album.js b/03ejercicio/Album.js new file mode 100644 index 0000000..57faafc --- /dev/null +++ b/03ejercicio/Album.js @@ -0,0 +1,8 @@ +class Album { + constructor (nombre, fecha ) { + this.nombre = nombre + this.fecha = fecha + } +} + +module.exports = Album \ No newline at end of file diff --git a/03ejercicio/Autor.js b/03ejercicio/Autor.js new file mode 100644 index 0000000..c2919a0 --- /dev/null +++ b/03ejercicio/Autor.js @@ -0,0 +1,8 @@ +class Autor { + constructor (nombre, pais) { + this.nombre = nombre + this.pais = pais + } +} + +module.exports = Autor \ No newline at end of file diff --git a/03ejercicio/Cancion.js b/03ejercicio/Cancion.js new file mode 100644 index 0000000..0381f85 --- /dev/null +++ b/03ejercicio/Cancion.js @@ -0,0 +1,13 @@ +const Autor = require('./Autor'), + Album = require('./Album') +class Cancion { + constructor (titulo, duracion ,autor, album) { + this.titulo = titulo + this.duracion = duracion + this.autor = new Autor (autor.name, autor.pais) + this.album = new Album (album.name, album.fecha) + } + +} + +module.exports = Cancion \ No newline at end of file diff --git a/03ejercicio/DB.js b/03ejercicio/DB.js new file mode 100644 index 0000000..da41e94 --- /dev/null +++ b/03ejercicio/DB.js @@ -0,0 +1,6 @@ +class DB { + constructor (canciones) { + this.canciones = canciones + } +} +module.exports = DB \ No newline at end of file diff --git a/03ejercicio/index.js b/03ejercicio/index.js new file mode 100644 index 0000000..83b4664 --- /dev/null +++ b/03ejercicio/index.js @@ -0,0 +1,8 @@ +const Cancion = require ('./Cancion'), + DB = require ('./DB') + +let init = new DB([]) +init.canciones + .push(new Cancion('cancion',4.3, {name: 'Luis', pais : 'PerĂº'}, {name :'Mejorando',fecha : '2019-05-03'})) + +console.log(init.canciones)