Skip to content

Commit

Permalink
POP
Browse files Browse the repository at this point in the history
POO

see also:
resolves:
  • Loading branch information
brian-emarquez committed Mar 21, 2021
1 parent 57701b4 commit a8990f1
Show file tree
Hide file tree
Showing 12 changed files with 1,032 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ los Objetos peuden tener funciones asociadasa él. En ese caso se les denomina M
| Carpeta | Link | ome | Code | Version | Estado |
|--------------|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|
| [POO ](https://github.com/BrianMarquez3/JavaScript-Course/tree/main/016%20Funciones) | :heavy_check_mark: | ⬅️ [Atras](#Tabla-de-contenidos) | yes | yes |
| [POO ](https://github.com/BrianMarquez3/JavaScript-Course/tree/main/017%20POO%20-%20Clases) | :heavy_check_mark: | ⬅️ [Atras](#Tabla-de-contenidos) | yes | yes |
Expand Down
8 changes: 8 additions & 0 deletions clases_y_objetos_Practica/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clases_y_objetos_Practica/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions clases_y_objetos_Practica/.idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions clases_y_objetos_Practica/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions clases_y_objetos_Practica/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions clases_y_objetos_Practica/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions clases_y_objetos_Practica/clases_y_objetos_practica.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
10 changes: 10 additions & 0 deletions clases_y_objetos_Practica/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Practica Guiada</title>
</head>
<body>
<script src="pratica.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions clases_y_objetos_Practica/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "clases_y_objetos_Practica",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
52 changes: 52 additions & 0 deletions clases_y_objetos_Practica/pratica.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class Book{
constructor(title, author, year, gender){
this.title = title
this.author = author
this.year = year
this.gender = gender
}
getAuthor (){
return this.author
}
getGender(){
return this.gender
}
bookInfo(){
return `${this.title} es un libro de ${this.gender} escrito por ${this.author} en el año ${this.year}`
}
}
let books = []
while (books.length<1){
let title = prompt('Intruduce el titulo del libro')
let author = prompt('Intruduce el autor del libro')
let year = prompt('Intruduce el año del libro')
let gender = prompt('Intruduce el genero del libro').toLowerCase()

if(title !='' && author !='' && !isNaN(year) && year.length == 4 && (gender == 'aventura' || gender == 'terror' || gender =='fantasia')){
books.push(new Book(title, author, year, gender))
}
}

const showAllBooks = () => {
console.log(books);
}
const showAuthors = () => {
let authors = []

for (const book of books ){
authors.push(book.getAuthor());
}
console.log(authors.sort());
}

const showGender = () =>{
const gender = prompt('Introduce el genero a buscar')
for (const book of books ){
if(book.getGender() == gender){
console.log(book.bookInfo())
}
}
}

//showAuthors()
showGender()
Loading

0 comments on commit a8990f1

Please sign in to comment.