Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dev-oo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ethan Robert
dev-oo
Commits
52bdadef
Commit
52bdadef
authored
2 months ago
by
Ethan Robert
Browse files
Options
Downloads
Patches
Plain Diff
tpOO-03::exo-Task
parent
515f859e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/tp03/Task.java
+14
-1
14 additions, 1 deletion
src/tp03/Task.java
src/tp03/UseLocalDate.java
+2
-2
2 additions, 2 deletions
src/tp03/UseLocalDate.java
src/tp03/UseTask.java
+14
-3
14 additions, 3 deletions
src/tp03/UseTask.java
with
30 additions
and
6 deletions
src/tp03/Task.java
+
14
−
1
View file @
52bdadef
...
...
@@ -51,8 +51,21 @@ public class Task {
for
(
int
i
=
0
;
i
<
TaskStatus
.
values
().
length
;
i
++)
{
if
(
TaskStatus
.
values
()[
i
].
equals
(
this
.
status
))
{
// Use modulo to avoid errors
this
.
status
=
TaskStatus
.
values
()[
i
+
1
%
TaskStatus
.
values
().
length
];
this
.
status
=
TaskStatus
.
values
()[
i
+
1
%
TaskStatus
.
values
().
length
-
1
];
}
}
}
public
boolean
isLate
()
{
LocalDate
now
=
LocalDate
.
now
();
if
(
this
.
deadline
.
compareTo
(
now
)
<
0
)
{
return
true
;
}
return
false
;
}
public
void
delay
(
int
nbDays
)
{
this
.
deadline
=
this
.
deadline
.
plusDays
(
nbDays
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/tp03/UseLocalDate.java
+
2
−
2
View file @
52bdadef
package
tp03.ex01
;
import
java.time.LocalDate
;
import
java.time.chrono.ChronoLocalDate
;
import
java.util.Random
;
import
java.time.Period
;
package
tp03.ex01
;
public
class
UseLocalDate
{
public
static
boolean
inArray
(
int
[]
array
,
int
value
)
{
...
...
This diff is collapsed.
Click to expand it.
src/tp03/UseTask.java
+
14
−
3
View file @
52bdadef
...
...
@@ -2,8 +2,6 @@ package tp03.ex02;
import
java.time.LocalDate
;
import
tp03.ex02.TaskStatus
;
public
class
UseTask
{
public
static
void
main
(
String
[]
args
)
{
...
...
@@ -19,7 +17,20 @@ public class UseTask {
System
.
out
.
println
(
t1
);
System
.
out
.
println
(
t2
);
// Test of isLate()
Task
t3
=
new
Task
(
"Finir exo3"
,
LocalDate
.
of
(
2025
,
02
,
01
),
LocalDate
.
of
(
2025
,
02
,
10
),
5
);
Task
t4
=
new
Task
(
"Finir exo4"
,
LocalDate
.
of
(
2025
,
02
,
01
),
LocalDate
.
of
(
2025
,
02
,
10
),
5
);
System
.
out
.
println
(
t3
+
", "
+
t3
.
isLate
());
System
.
out
.
println
(
t4
+
", "
+
t4
.
isLate
());
t3
.
changeStatus
(
TaskStatus
.
FINISHED
);
t4
.
delay
(
30
);
System
.
out
.
println
(
t3
+
", "
+
t3
.
isLate
());
System
.
out
.
println
(
t4
+
", "
+
t4
.
isLate
());
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment