diff --git a/AmazonViewer/.classpath b/AmazonViewer/.classpath new file mode 100644 index 0000000..8da7346 --- /dev/null +++ b/AmazonViewer/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/AmazonViewer/.project b/AmazonViewer/.project new file mode 100644 index 0000000..b9f7f63 --- /dev/null +++ b/AmazonViewer/.project @@ -0,0 +1,17 @@ + + + AmazonViewer + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/AmazonViewer/.settings/org.eclipse.jdt.core.prefs b/AmazonViewer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7e5c907 --- /dev/null +++ b/AmazonViewer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=9 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=9 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=9 diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/Main.class b/AmazonViewer/bin/com/anncode/amazonviewer/Main.class new file mode 100644 index 0000000..14f4089 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/Main.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Book.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Book.class new file mode 100644 index 0000000..48827a6 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Book.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Chapter.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Chapter.class new file mode 100644 index 0000000..c2b076b Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Chapter.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Film.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Film.class new file mode 100644 index 0000000..6eb09f5 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Film.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/IVisualizable.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/IVisualizable.class new file mode 100644 index 0000000..e96d32c Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/IVisualizable.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Magazine.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Magazine.class new file mode 100644 index 0000000..4ce039f Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Magazine.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Movie.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Movie.class new file mode 100644 index 0000000..4c1395a Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Movie.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Publication.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Publication.class new file mode 100644 index 0000000..e8a8450 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Publication.class differ diff --git a/AmazonViewer/bin/com/anncode/amazonviewer/model/Serie.class b/AmazonViewer/bin/com/anncode/amazonviewer/model/Serie.class new file mode 100644 index 0000000..54ba3f3 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/amazonviewer/model/Serie.class differ diff --git a/AmazonViewer/bin/com/anncode/util/AmazonUtil.class b/AmazonViewer/bin/com/anncode/util/AmazonUtil.class new file mode 100644 index 0000000..0e26b87 Binary files /dev/null and b/AmazonViewer/bin/com/anncode/util/AmazonUtil.class differ diff --git a/AmazonViewer/libs/makefile.jar b/AmazonViewer/libs/makefile.jar new file mode 100644 index 0000000..fe69534 Binary files /dev/null and b/AmazonViewer/libs/makefile.jar differ diff --git a/AmazonViewer/reporte2018-01-26.txt b/AmazonViewer/reporte2018-01-26.txt new file mode 100644 index 0000000..e6113df --- /dev/null +++ b/AmazonViewer/reporte2018-01-26.txt @@ -0,0 +1,21 @@ + + :: MOVIE :: + Title: Movie 2 + Genero: Genero 2 + Year: 2019 + Creator: Creador 2 + Duration: 122 + + :: MOVIE :: + Title: Movie 3 + Genero: Genero 3 + Year: 2020 + Creator: Creador 3 + Duration: 123 + + :: MOVIE :: + Title: Movie 5 + Genero: Genero 5 + Year: 2022 + Creator: Creador 5 + Duration: 125 diff --git a/AmazonViewer/src/com/anncode/amazonviewer/Main.java b/AmazonViewer/src/com/anncode/amazonviewer/Main.java new file mode 100644 index 0000000..0cd5c64 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/Main.java @@ -0,0 +1,368 @@ +package com.anncode.amazonviewer; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Scanner; + +import com.anncode.amazonviewer.model.Book; +import com.anncode.amazonviewer.model.Chapter; +import com.anncode.amazonviewer.model.Magazine; +import com.anncode.amazonviewer.model.Movie; +import com.anncode.amazonviewer.model.Serie; +import com.anncode.makereport.Report; +import com.anncode.util.AmazonUtil; + +public class Main { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + showMenu(); + + } + + public static void showMenu() { + int exit = 0; + do { + + System.out.println("BIENVENIDOS AMAZON VIEWER"); + System.out.println(""); + System.out.println("Selecciona el número de la opción deseada"); + System.out.println("1. Movies"); + System.out.println("2. Series"); + System.out.println("3. Books"); + System.out.println("4. Magazines"); + System.out.println("5. Report"); + System.out.println("6. Report Today"); + System.out.println("0. Exit"); + + //Leer la respuesta del usuario + int response = AmazonUtil.validateUserResponseMenu(0, 6); + + switch (response) { + case 0: + //salir + exit = 0; + break; + case 1: + showMovies(); + break; + case 2: + showSeries(); + break; + case 3: + showBooks(); + break; + case 4: + showMagazines(); + break; + case 5: + makeReport(); + exit = 1; + break; + case 6: + //Date date = new Date(); + makeReport(new Date()); + exit = 1; + break; + + default: + System.out.println(); + System.out.println("....¡¡Selecciona una opción!!...."); + System.out.println(); + exit = 1; + break; + } + + + }while(exit != 0); + } + + static ArrayList movies = Movie.makeMoviesList(); + public static void showMovies() { + int exit = 1; + + do { + System.out.println(); + System.out.println(":: MOVIES ::"); + System.out.println(); + + for (int i = 0; i < movies.size(); i++) { //1. Movie 1 + System.out.println(i+1 + ". " + movies.get(i).getTitle() + " Visto: " + movies.get(i).isViewed()); + } + + System.out.println("0. Regresar al Menu"); + System.out.println(); + + //Leer Respuesta usuario + int response = AmazonUtil.validateUserResponseMenu(0, movies.size()); + + if(response == 0) { + exit = 0; + showMenu(); + break; + } + if (response > 0) { + Movie movieSelected = movies.get(response-1); + movieSelected.setViewed(true); + Date dateI = movieSelected.startToSee(new Date()); + + for (int i = 0; i < 100000; i++) { + System.out.println(".........."); + } + + //Termine de verla + movieSelected.stopToSee(dateI, new Date()); + System.out.println(); + System.out.println("Viste: " + movieSelected); + System.out.println("Por: " + movieSelected.getTimeViewed() + " milisegundos"); + } + + + }while(exit !=0); + + } + static ArrayList series = Serie.makeSeriesList(); + public static void showSeries() { + int exit = 1; + + do { + System.out.println(); + System.out.println(":: SERIES ::"); + System.out.println(); + + for (int i = 0; i < series.size(); i++) { //1. Serie 1 + System.out.println(i+1 + ". " + series.get(i).getTitle() + " Visto: " + series.get(i).isViewed()); + } + + System.out.println("0. Regresar al Menu"); + System.out.println(); + + //Leer Respuesta usuario + int response = AmazonUtil.validateUserResponseMenu(0, series.size()); + + if(response == 0) { + exit = 0; + showMenu(); + } + + if(response > 0) { + showChapters(series.get(response-1).getChapters()); + } + + + }while(exit !=0); + } + + public static void showChapters(ArrayList chaptersOfSerieSelected) { + int exit = 1; + + do { + System.out.println(); + System.out.println(":: CHAPTERS ::"); + System.out.println(); + + + for (int i = 0; i < chaptersOfSerieSelected.size(); i++) { //1. Chapter 1 + System.out.println(i+1 + ". " + chaptersOfSerieSelected.get(i).getTitle() + " Visto: " + chaptersOfSerieSelected.get(i).isViewed()); + } + + System.out.println("0. Regresar al Menu"); + System.out.println(); + + //Leer Respuesta usuario + int response = AmazonUtil.validateUserResponseMenu(0, chaptersOfSerieSelected.size()); + + if(response == 0) { + exit = 0; + } + + + if(response > 0) { + Chapter chapterSelected = chaptersOfSerieSelected.get(response-1); + chapterSelected.setViewed(true); + Date dateI = chapterSelected.startToSee(new Date()); + + for (int i = 0; i < 100000; i++) { + System.out.println(".........."); + } + + //Termine de verla + chapterSelected.stopToSee(dateI, new Date()); + System.out.println(); + System.out.println("Viste: " + chapterSelected); + System.out.println("Por: " + chapterSelected.getTimeViewed() + " milisegundos"); + } + }while(exit !=0); + } + + static ArrayList books= Book.makeBookList(); + public static void showBooks() { + int exit = 1; + + do { + System.out.println(); + System.out.println(":: BOOKS ::"); + System.out.println(); + + for (int i = 0; i < books.size(); i++) { //1. Book 1 + System.out.println(i+1 + ". " + books.get(i).getTitle() + " Leído: " + books.get(i).isReaded()); + } + + System.out.println("0. Regresar al Menu"); + System.out.println(); + + //Leer Respuesta usuario + int response = AmazonUtil.validateUserResponseMenu(0, books.size()); + + if(response == 0) { + exit = 0; + showMenu(); + } + + if(response > 0) { + Book bookSelected = books.get(response-1); + bookSelected.setReaded(true); + Date dateI = bookSelected.startToSee(new Date()); + + for (int i = 0; i < 100000; i++) { + System.out.println(".........."); + } + + //Termine de verla + bookSelected.stopToSee(dateI, new Date()); + System.out.println(); + System.out.println("Leíste: " + bookSelected); + System.out.println("Por: " + bookSelected.getTimeReaded() + " milisegundos"); + } + + }while(exit !=0); + } + + public static void showMagazines() { + ArrayList magazines = Magazine.makeMagazineList(); + int exit = 0; + do { + System.out.println(); + System.out.println(":: MAGAZINES ::"); + System.out.println(); + + for (int i = 0; i < magazines.size(); i++) { //1. Book 1 + System.out.println(i+1 + ". " + magazines.get(i).getTitle()); + } + + System.out.println("0. Regresar al Menu"); + System.out.println(); + + //Leer Respuesta usuario + int response = AmazonUtil.validateUserResponseMenu(0, 0); + + if(response == 0) { + exit = 0; + showMenu(); + } + + + }while(exit !=0); + } + + public static void makeReport() { + + Report report = new Report(); + report.setNameFile("reporte"); + report.setExtension("txt"); + report.setTitle(":: VISTOS ::"); + String contentReport = ""; + + for (Movie movie : movies) { + if (movie.getIsViewed()) { + contentReport += movie.toString() + "\n"; + + } + } + + for (Serie serie : series) { + ArrayList chapters = serie.getChapters(); + for (Chapter chapter : chapters) { + if (chapter.getIsViewed()) { + contentReport += chapter.toString() + "\n"; + + } + } + } + + + for (Book book : books) { + if (book.getIsReaded()) { + contentReport += book.toString() + "\n"; + + } + } + + report.setContent(contentReport); + report.makeReport(); + System.out.println("Reporte Generado"); + System.out.println(); + } + + public static void makeReport(Date date) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd-h-m-s-S"); + String dateString = df.format(date); + Report report = new Report(); + + report.setNameFile("reporte" + dateString); + report.setExtension("txt"); + report.setTitle(":: VISTOS ::"); + + + SimpleDateFormat dfNameDays = new SimpleDateFormat("E, W MMM Y"); + dateString = dfNameDays.format(date); + String contentReport = "Date: " + dateString + "\n\n\n"; + + for (Movie movie : movies) { + if (movie.getIsViewed()) { + contentReport += movie.toString() + "\n"; + + } + } + + for (Serie serie : series) { + ArrayList chapters = serie.getChapters(); + for (Chapter chapter : chapters) { + if (chapter.getIsViewed()) { + contentReport += chapter.toString() + "\n"; + + } + } + } + + for (Book book : books) { + if (book.getIsReaded()) { + contentReport += book.toString() + "\n"; + + } + } + report.setContent(contentReport); + report.makeReport(); + + System.out.println("Reporte Generado"); + System.out.println(); + } + +} + + + + + + + + + + + + + + + diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Book.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Book.java new file mode 100644 index 0000000..713e658 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Book.java @@ -0,0 +1,110 @@ +package com.anncode.amazonviewer.model; + +import java.util.ArrayList; +import java.util.Date; + +public class Book extends Publication implements IVisualizable { + private int id; + private String isbn; + private boolean readed; + private int timeReaded; + + + public Book(String title, Date edititionDate, String editorial, String[] authors) { + super(title, edititionDate, editorial); + // TODO Auto-generated constructor stub + setAuthors(authors); + } + + + public int getId() { + return id; + } + + + public String getIsbn() { + return isbn; + } + + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + + public String isReaded() { + String leido = ""; + if(readed == true) { + leido = "Sí"; + }else { + leido = "No"; + } + + return leido; + } + + + public void setReaded(boolean readed) { + this.readed = readed; + } + + public boolean getIsReaded() { + return readed; + } + + + public int getTimeReaded() { + return timeReaded; + } + + + public void setTimeReaded(int timeReaded) { + this.timeReaded = timeReaded; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + String detailBook = "\n :: BOOK ::" + + "\n Title: " + getTitle() + + "\n Editorial: " + getEditorial() + + "\n Edition Date: " + getEdititionDate() + + "\n Authors: "; + for (int i = 0; i < getAuthors().length; i++) { + detailBook += "\t" + getAuthors()[i] + " "; + } + return detailBook; + } + + + @Override + public Date startToSee(Date dateI) { + // TODO Auto-generated method stub + return dateI; + } + + + @Override + public void stopToSee(Date dateI, Date dateF) { + // TODO Auto-generated method stub + if (dateF.getTime() > dateI.getTime()) { + setTimeReaded((int)(dateF.getTime() - dateI.getTime())); + }else { + setTimeReaded(0); + } + } + + public static ArrayList makeBookList() { + ArrayList books = new ArrayList(); + String[] authors = new String[3]; + for (int i = 0; i < 3; i++) { + authors[i] = "author "+i; + } + for (int i = 1; i <= 5; i++) { + books.add(new Book("Book " + i, new Date(), "editorial " + i, authors)); + } + + return books; + } + +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Chapter.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Chapter.java new file mode 100644 index 0000000..3eadcd5 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Chapter.java @@ -0,0 +1,64 @@ +package com.anncode.amazonviewer.model; + +import java.util.ArrayList; + +public class Chapter extends Movie { + + + private int id; + private int sessionNumber; + private Serie serie; + + public Chapter(String title, String genre, String creator, int duration, short year, int sessionNumber, Serie serie) { + super(title, genre, creator, duration, year); + // TODO Auto-generated constructor stub + this.setSessionNumber(sessionNumber); + this.setSerie(serie); + } + + @Override + public int getId() { + // TODO Auto-generated method stub + return this.id; + } + + public int getSessionNumber() { + return sessionNumber; + } + + public void setSessionNumber(int sessionNumber) { + this.sessionNumber = sessionNumber; + } + + + public Serie getSerie() { + return serie; + } + + public void setSerie(Serie serie) { + this.serie = serie; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return "\n :: SERIE ::" + + "\n Title: " + getSerie().getTitle() + + "\n :: CHAPTER ::" + + "\n Title: " + getTitle() + + "\n Year: " + getYear() + + "\n Creator: " + getCreator() + + "\n Duration: " + getDuration(); + } + + + public static ArrayList makeChaptersList(Serie serie) { + ArrayList chapters = new ArrayList(); + + for (int i = 1; i <= 5; i++) { + chapters.add(new Chapter("Capituo "+i, "genero "+i, "creator" +i, 45, (short)(2017+i), i, serie)); + } + + return chapters; + } +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Film.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Film.java new file mode 100644 index 0000000..4a6c4b4 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Film.java @@ -0,0 +1,73 @@ +package com.anncode.amazonviewer.model; + +public class Film { + + private String title; + private String genre; + private String creator; + private int duration; + private short year; + private boolean viewed; + + + + public Film(String title, String genre, String creator, int duration) { + super(); + this.title = title; + this.genre = genre; + this.creator = creator; + this.duration = duration; + } + + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public String getGenre() { + return genre; + } + public void setGenre(String genre) { + this.genre = genre; + } + public String getCreator() { + return creator; + } + public void setCreator(String creator) { + this.creator = creator; + } + public int getDuration() { + return duration; + } + public void setDuration(int duration) { + this.duration = duration; + } + public short getYear() { + return year; + } + public void setYear(short year) { + this.year = year; + } + public String isViewed() { + String visto = ""; + if(viewed == true) { + visto = "Sí"; + }else { + visto = "No"; + } + + return visto; + } + + public boolean getIsViewed() { + return viewed; + } + public void setViewed(boolean viewed) { + this.viewed = viewed; + } + + + + +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/IVisualizable.java b/AmazonViewer/src/com/anncode/amazonviewer/model/IVisualizable.java new file mode 100644 index 0000000..6f0d4cb --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/IVisualizable.java @@ -0,0 +1,9 @@ +package com.anncode.amazonviewer.model; + +import java.util.Date; + +public interface IVisualizable { + Date startToSee(Date dateI); + void stopToSee(Date dateI, Date dateF); + +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Magazine.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Magazine.java new file mode 100644 index 0000000..e71ec0c --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Magazine.java @@ -0,0 +1,46 @@ +package com.anncode.amazonviewer.model; + +import java.util.ArrayList; +import java.util.Date; + +public class Magazine extends Publication { + + private int id; + + public Magazine(String title, Date edititionDate, String editorial) { + super(title, edititionDate, editorial); + // TODO Auto-generated constructor stub + } + + public int getId() { + return id; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + String detailMagazine = "\n :: MAGAZINE ::" + + "\n Title: " + getTitle() + + "\n Editorial: " + getEditorial() + + "\n Edition Date: " + getEdititionDate() + + "\n Authors: "; + for (int i = 0; i < getAuthors().length; i++) { + detailMagazine += "\t" + getAuthors()[i] + " "; + } + return detailMagazine; + } + + public static ArrayList makeMagazineList() { + ArrayList magazines = new ArrayList(); + String[] authors = new String[3]; + for (int i = 0; i < 3; i++) { + authors[i] = "author "+i; + } + for (int i = 1; i <= 5; i++) { + magazines.add(new Magazine("Magazine " + i, new Date(), "Editorial " + i)); + } + + return magazines; + } + +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Movie.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Movie.java new file mode 100644 index 0000000..bacbcd1 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Movie.java @@ -0,0 +1,77 @@ +package com.anncode.amazonviewer.model; + +import java.util.ArrayList; +import java.util.Date; + +public class Movie extends Film implements IVisualizable { + + private int id; + private int timeViewed; + + + public Movie(String title, String genre, String creator, int duration, short year) { + super(title, genre, creator, duration); + setYear(year); + } + + + public int getId() { + return id; + } + + + public int getTimeViewed() { + return timeViewed; + } + public void setTimeViewed(int timeViewed) { + this.timeViewed = timeViewed; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return "\n :: MOVIE ::" + + "\n Title: " + getTitle() + + "\n Genero: " + getGenre() + + "\n Year: " + getYear() + + "\n Creator: " + getCreator() + + "\n Duration: " + getDuration(); + } + + @Override + public Date startToSee(Date dateI) { + // TODO Auto-generated method stub + return dateI; + } + + @Override + public void stopToSee(Date dateI, Date dateF) { + // TODO Auto-generated method stub + + if (dateF.getTime() > dateI.getTime()) { + setTimeViewed((int)(dateF.getTime() - dateI.getTime())); + }else { + setTimeViewed(0); + } + + + } + + public static ArrayList makeMoviesList() { + ArrayList movies = new ArrayList(); + + for (int i = 1; i <= 5; i++) { + movies.add(new Movie("Movie " + i, "Genero " + i, "Creador " + i, 120+i, (short)(2017+i))); + } + + return movies; + } + +} + + + + + + + diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Publication.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Publication.java new file mode 100644 index 0000000..22d2322 --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Publication.java @@ -0,0 +1,48 @@ +package com.anncode.amazonviewer.model; + +import java.util.Date; + +public class Publication { + + private String title; + private Date edititionDate; + private String editorial; + private String[] authors; + + + public Publication(String title, Date edititionDate, String editorial) { + super(); + this.title = title; + this.edititionDate = edititionDate; + this.editorial = editorial; + } + + + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public Date getEdititionDate() { + return edititionDate; + } + public void setEdititionDate(Date edititionDate) { + this.edititionDate = edititionDate; + } + public String getEditorial() { + return editorial; + } + public void setEditorial(String editorial) { + this.editorial = editorial; + } + public String[] getAuthors() { + return authors; + } + public void setAuthors(String[] authors) { + this.authors = authors; + } + + + +} diff --git a/AmazonViewer/src/com/anncode/amazonviewer/model/Serie.java b/AmazonViewer/src/com/anncode/amazonviewer/model/Serie.java new file mode 100644 index 0000000..f35f9de --- /dev/null +++ b/AmazonViewer/src/com/anncode/amazonviewer/model/Serie.java @@ -0,0 +1,64 @@ +package com.anncode.amazonviewer.model; + +import java.util.ArrayList; + +public class Serie extends Film { + + private int id; + private int sessionQuantity; + private ArrayList chapters; + + + public Serie(String title, String genre, String creator, int duration, int sessionQuantity) { + super(title, genre, creator, duration); + // TODO Auto-generated constructor stub + this.sessionQuantity = sessionQuantity; + } + + + + public int getId() { + return id; + } + + public int getSessionQuantity() { + return sessionQuantity; + } + + public void setSessionQuantity(int sessionQuantity) { + this.sessionQuantity = sessionQuantity; + } + + public ArrayList getChapters() { + return chapters; + } + + public void setChapters(ArrayList chapters) { + this.chapters = chapters; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return "\n :: SERIE ::" + + "\n Title: " + getTitle() + + "\n Genero: " + getGenre() + + "\n Year: " + getYear() + + "\n Creator: " + getCreator() + + "\n Duration: " + getDuration(); + } + + public static ArrayList makeSeriesList() { + ArrayList series = new ArrayList(); + + for (int i = 1; i <= 5; i++) { + Serie serie = new Serie("Serie "+i, "genero "+i, "creador "+i, 1200, 5); + serie.setChapters(Chapter.makeChaptersList(serie)); + series.add(serie); + + } + + return series; + } + +} diff --git a/AmazonViewer/src/com/anncode/util/AmazonUtil.java b/AmazonViewer/src/com/anncode/util/AmazonUtil.java new file mode 100644 index 0000000..d82107e --- /dev/null +++ b/AmazonViewer/src/com/anncode/util/AmazonUtil.java @@ -0,0 +1,37 @@ +package com.anncode.util; + +import java.util.Scanner; + +public class AmazonUtil { + + public static int validateUserResponseMenu(int min, int max) { + //Leer la respuesta del usuario + Scanner sc = new Scanner(System.in); + + //Validar respuesta int + while(!sc.hasNextInt()) { + sc.next(); + System.out.println("No ingresaste una opción válida1"); + System.out.println("Intenta otra vez1"); + } + + int response = sc.nextInt(); + + //Validar rango de respuesta + while(response < min || response > max) { + //Solicitar de nuevo la respuesta + System.out.println("No ingresaste una opción válida"); + System.out.println("Intenta otra vez"); + + while(!sc.hasNextInt()) { + sc.next(); + System.out.println("No ingresaste una opción válida"); + System.out.println("Intenta otra vez"); + } + response = sc.nextInt(); + } + System.out.println("Tu Respuesta fue: " + response + "\n"); + return response; + } + +} diff --git a/HolaMundo/HolaMundo.class b/HolaMundo/HolaMundo.class deleted file mode 100644 index 24cda32..0000000 Binary files a/HolaMundo/HolaMundo.class and /dev/null differ diff --git a/HolaMundo/HolaMundo.java b/HolaMundo/HolaMundo.java deleted file mode 100644 index 436cd23..0000000 --- a/HolaMundo/HolaMundo.java +++ /dev/null @@ -1,5 +0,0 @@ -public class HolaMundo { - public static void main(String[] args){ - System.out.println("Hola Mundo :)"); - } -} \ No newline at end of file