Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
jesus morales villegas
/
diseno_software
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7621768c
authored
Dec 27, 2023
by
jesus morales villegas
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
comprobar usuario terminado
parent
ab2187de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
src/Biblioteca.java
src/Lector.java
src/Biblioteca.java
View file @
7621768c
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.HashMap
;
public
class
Biblioteca
{
public
class
Biblioteca
{
public
HashMap
<
Integer
,
Lector
>
usuarios
;
private
Biblioteca
_instancia
;
private
Biblioteca
_instancia
;
public
Catalogo
_unnamed_Catalogo_18
;
public
Catalogo
_unnamed_Catalogo_18
;
public
Usuario
_hay
;
public
Usuario
_hay
;
...
@@ -14,8 +17,19 @@ public class Biblioteca {
...
@@ -14,8 +17,19 @@ public class Biblioteca {
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
public
Boolean
ComprobarUsuario
(
Object
aIDUsuario
)
{
public
Boolean
ComprobarUsuario
(
Integer
idUsuario
)
{
throw
new
UnsupportedOperationException
();
if
(
usuarios
.
containsKey
(
idUsuario
)){
if
(
usuarios
.
get
(
idUsuario
).
get_numPenalizaciones
()==
0
)
return
true
;
LocalDate
fecha
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"dd-MM-yyyy"
);
String
fechaActual
=
fecha
.
format
(
formatter
);
LocalDate
fechaPenalizacion
=
LocalDate
.
parse
(
usuarios
.
get
(
idUsuario
).
get_fechaPenalizacion
(),
formatter
);
LocalDate
fechaLocalActual
=
LocalDate
.
parse
(
fechaActual
,
formatter
);
return
!
fechaPenalizacion
.
isAfter
(
fechaLocalActual
);
}
else
return
false
;
}
}
public
void
RecibirLibro
(
String
aTitulo
)
{
public
void
RecibirLibro
(
String
aTitulo
)
{
...
...
src/Lector.java
View file @
7621768c
...
@@ -36,4 +36,20 @@ public class Lector extends Usuario {
...
@@ -36,4 +36,20 @@ public class Lector extends Usuario {
public
Integer
ComprobarNumLibros
()
{
public
Integer
ComprobarNumLibros
()
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
public
String
get_fechaPenalizacion
()
{
return
_fechaPenalizacion
;
}
public
void
set_fechaPenalizacion
(
String
_fechaPenalizacion
)
{
this
.
_fechaPenalizacion
=
_fechaPenalizacion
;
}
public
Integer
get_numPenalizaciones
()
{
return
_numPenalizaciones
;
}
public
void
set_numPenalizaciones
(
Integer
_numPenalizaciones
)
{
this
.
_numPenalizaciones
=
_numPenalizaciones
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment