From cb287c1b293dd4693fef9cc259539e783c398768 Mon Sep 17 00:00:00 2001 From: Heidy Gerbi Date: Sat, 1 Jun 2019 23:39:47 -0500 Subject: [PATCH] =?UTF-8?q?reto=20parte=20b=C3=A1sica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Retos/sesion3-reto1/ejercicio3.js | 75 +++++++++++++++++++++++++++++++ package.json | 25 +++++++++++ 2 files changed, 100 insertions(+) create mode 100644 Retos/sesion3-reto1/ejercicio3.js create mode 100644 package.json diff --git a/Retos/sesion3-reto1/ejercicio3.js b/Retos/sesion3-reto1/ejercicio3.js new file mode 100644 index 0000000..fc56a37 --- /dev/null +++ b/Retos/sesion3-reto1/ejercicio3.js @@ -0,0 +1,75 @@ +class Actor { + constructor(nombre, apellido, fechaNac, rol) { + this.nombre = nombre; + this.apellido = apellido; + this.fechaNac = fechaNac; + this.rol = rol; + } +} + +class Director { + constructor(nombre, apellido) { + this.nombre = nombre; + this.apellido = apellido; + } +} + +class Pelicula { + constructor(genero, titulo, duracion, actores, director) { + this.genero = genero; + this.titulo = titulo; + this.duracion = duracion; + this.actor = new Actor(Actor.nombre, Actor.apellido, Actor.fechaNac, Actor.rol); + this.director = new Director(Director.nombre, Director.apellido); + } +} +class Pago { + constructor(fechaPago, monto, estatus){ + this.fechaPago = fechaPago; + this.monto = monto; + this.estatus = estatus; + } +} +class Cliente { + constructor(email, plan, pago) { + this.email = email; + this.plan = plan; + this.pago = new Pago(Pago.fechaPago, Pago.monto, Pago.estatus); + } +} + +class db { + constructor(peliculas, clientes) { + this.peliculas = peliculas; + this.clientes = clientes; + } +} + +let NetflixDB; + +function Netflix () { + return { + init: function () { + NetflixDB = new db([],[]); + }, + agregarPelicula: function (genero, titulo, duracion, actor, director) { + NetflixDB.peliculas.push(new Pelicula(genero, titulo, duracion, actor, director)); + }, + agregarCliente: function (email, plan, pago) { + NetflixDB.clientes.push(new Cliente(email, plan, pago)); + } + + } +} + +let NetflixInstance = Netflix(); + +NetflixInstance.init(); + +NetflixInstance.agregarPelicula('Acción', 'Peli uno', 2, {nombre: 'Pancho', apellido: 'Huaman', fechaNac: '12/12/1970', rol: 'Protagonista'}, {nombre: 'María', apellido: 'Rodriguez'}); +NetflixInstance.agregarPelicula('Comedia', 'Pelicula dos', 4, {nombre: 'Manuel', apellido: 'Rojas', fechaNac: '12/12/1988', rol: 'Reparto'}, {nombre: 'Pepe', apellido: 'Aquino'}); + +NetflixInstance.agregarCliente('cliente1@gmail.com', 'Básico', {fechaPago: '01/06/2019', monto: 15.00, estatus: 'solvente'}); +NetflixInstance.agregarCliente('cliente2@gmail.com', 'Premium', {fechaPago: '01/05/2019', monto: 35.00, estatus: 'no solvente'}); + +console.log(NetflixDB); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d96e237 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "serverless-training", + "version": "1.0.0", + "description": "practica backend", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/heidygerbi/Serverless-Training.git" + }, + "keywords": [ + "class", + "js", + "poo", + "backend" + ], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/heidygerbi/Serverless-Training/issues" + }, + "homepage": "https://github.com/heidygerbi/Serverless-Training#readme" +}