diff --git a/1ano/2semestre/lsd/aula02/LSD_2022-22_TrabPrat02.pdf b/1ano/2semestre/lsd/aula02/LSD_2022-22_TrabPrat02.pdf new file mode 100644 index 0000000..ba89cd4 Binary files /dev/null and b/1ano/2semestre/lsd/aula02/LSD_2022-22_TrabPrat02.pdf differ diff --git a/1ano/2semestre/lsd/aula02/README.md b/1ano/2semestre/lsd/aula02/README.md new file mode 100755 index 0000000..a31b6ac --- /dev/null +++ b/1ano/2semestre/lsd/aula02/README.md @@ -0,0 +1,9 @@ +# Laboratórios de Sistemas Digitais +## Trabalho prático 02 +### Tópico principal da aula: Modelação em VHDL, simulação e implementação de componentes combinatórios + +* [Slides](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP02.pdf) +* [Guião](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/lsd/aula02/LSD_2022-23_TrabPrat02.pdf) + +--- +*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new) diff --git a/1ano/2semestre/lsd/aula03/LSD_2022-23_TrabPrat03-1.pdf b/1ano/2semestre/lsd/aula03/LSD_2022-23_TrabPrat03-1.pdf new file mode 100644 index 0000000..a5a4057 Binary files /dev/null and b/1ano/2semestre/lsd/aula03/LSD_2022-23_TrabPrat03-1.pdf differ diff --git a/1ano/2semestre/lsd/aula03/README.md b/1ano/2semestre/lsd/aula03/README.md new file mode 100755 index 0000000..766ab86 --- /dev/null +++ b/1ano/2semestre/lsd/aula03/README.md @@ -0,0 +1,9 @@ +# Laboratórios de Sistemas Digitais +## Trabalho prático 03 +### Tópico principal da aula: Modelação em VHDL e implementação de circuitos aritméticos + +* [Slides](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP03.pdf) +* [Guião](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/lsd/aula03/LSD_2022-23_TrabPrat03-1.pdf) + +--- +*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new) diff --git a/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP02.pdf b/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP02.pdf new file mode 100644 index 0000000..1592094 Binary files /dev/null and b/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP02.pdf differ diff --git a/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP03.pdf b/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP03.pdf new file mode 100644 index 0000000..ea39386 Binary files /dev/null and b/1ano/2semestre/lsd/slides/LSD_2022-23_AulaTP03.pdf differ diff --git a/1ano/2semestre/poo/poo.iml b/1ano/2semestre/poo/poo.iml deleted file mode 100644 index c90834f..0000000 --- a/1ano/2semestre/poo/poo.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula03/Calendar.java b/1ano/2semestre/poo/src/aula03/Calendar.java index ba3711c..6b2cdef 100644 --- a/1ano/2semestre/poo/src/aula03/Calendar.java +++ b/1ano/2semestre/poo/src/aula03/Calendar.java @@ -45,7 +45,7 @@ public class Calendar { } private static void printCalendar(int[] data, int monthDays) { - System.out.printf("\n%13s %d\n", monthName(data[0]), data[1]); + System.out.printf("\n%15s %d\n", monthName(data[0]), data[1]); System.out.println("Dom Seg Ter Qua Qui Sex Sab"); if (data[2] != 7) diff --git a/1ano/2semestre/poo/src/aula03/Grades.java b/1ano/2semestre/poo/src/aula03/Grades.java index 0407fbb..4af54d7 100644 --- a/1ano/2semestre/poo/src/aula03/Grades.java +++ b/1ano/2semestre/poo/src/aula03/Grades.java @@ -31,16 +31,16 @@ public class Grades { System.out.printf("%5.1f %5.1f %5d\n", student.notaT, student.notaP, student.notaFinal); } } -} -class Student { - public double notaT; - public double notaP; - public int notaFinal; + private static class Student { + public double notaT; + public double notaP; + public int notaFinal; - public Student(double notaT, double notaP) { - this.notaT = notaT; - this.notaP = notaP; - this.notaFinal = (notaT < 7 || notaP < 7) ? 66 : (int) Math.round(0.4 * notaT + 0.6 * notaP); + public Student(double notaT, double notaP) { + this.notaT = notaT; + this.notaP = notaP; + this.notaFinal = (notaT < 7 || notaP < 7) ? 66 : (int) Math.round(0.4 * notaT + 0.6 * notaP); + } } } diff --git a/1ano/2semestre/poo/src/aula03/PrimesSum.java b/1ano/2semestre/poo/src/aula03/PrimesSum.java index 13425ad..b93a897 100644 --- a/1ano/2semestre/poo/src/aula03/PrimesSum.java +++ b/1ano/2semestre/poo/src/aula03/PrimesSum.java @@ -1,5 +1,6 @@ package aula03; +import utils.MathTools; import utils.UserInput; import java.util.Scanner; @@ -14,20 +15,11 @@ public class PrimesSum { int sum = 0; for (int i = 0; i <= n; i++) - if (isNumPrime(i)) + if (MathTools.isNumPrime(i)) sum += i; System.out.printf("A soma dos números primos até %d é %d\n", n, sum); sin.close(); } - - private static boolean isNumPrime(int n) { - if (n == 1) - return false; - for (int i = 2; i < n; i++) - if (n % i == 0) - return false; - return true; - } } diff --git a/1ano/2semestre/poo/src/utils/MathTools.java b/1ano/2semestre/poo/src/utils/MathTools.java index fa7c389..8744e9b 100644 --- a/1ano/2semestre/poo/src/utils/MathTools.java +++ b/1ano/2semestre/poo/src/utils/MathTools.java @@ -1,7 +1,23 @@ package utils; +import java.util.Random; + public class MathTools { public static double round(double n, int places) { return (Math.round(n * Math.pow(10, places))) / Math.pow(10, places); } + + public static double random(double minLimit, double maxLimit) { + Random rand = new Random(); + return rand.nextDouble(minLimit, maxLimit); + } + + public static boolean isNumPrime(int n) { + if (n <= 1) + return false; + for (int i = 2; i < n; i++) + if (n % i == 0) + return false; + return true; + } }