Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
programmation orientée objet
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Eckman
programmation orientée objet
Commits
2766d976
Commit
2766d976
authored
2 years ago
by
Nicolas Eckman
Browse files
Options
Downloads
Patches
Plain Diff
CTP2022
parent
bd89ef75
Branches
main
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tpOO/ctp2022/AgeCategory.java
+23
-0
23 additions, 0 deletions
src/tpOO/ctp2022/AgeCategory.java
src/tpOO/ctp2022/Infant.java
+24
-0
24 additions, 0 deletions
src/tpOO/ctp2022/Infant.java
with
47 additions
and
0 deletions
src/tpOO/ctp2022/AgeCategory.java
0 → 100644
+
23
−
0
View file @
2766d976
package
tpOO.ctp2022
;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
public
enum
AgeCategory
{
NURSELING
(
1.5
),
LITTLE
(
1.0
),
GROWN
(
0.8
);
private
final
double
QUOTA
;
public
double
getQuota
(){
return
QUOTA
;
}
private
AgeCategory
(
double
quota
){
this
.
QUOTA
=
quota
;
}
public
static
AgeCategory
getInstance
(
LocalDate
date
){
int
i
=
(
int
)
date
.
until
(
LocalDate
.
now
(),
ChronoUnit
.
MONTHS
);
if
(
i
<
8
)
return
AgeCategory
.
NURSELING
;
if
(
i
<
18
)
return
AgeCategory
.
LITTLE
;
else
return
AgeCategory
.
GROWN
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/tpOO/ctp2022/Infant.java
0 → 100644
+
24
−
0
View file @
2766d976
package
tpOO.ctp2022
;
import
java.time.LocalDate
;
public
class
Infant
{
private
final
String
FORENAME
;
private
String
name
;
private
final
LocalDate
BIRTH
;
private
AgeCategory
category
;
Infant
(
String
forename
,
String
name
,
LocalDate
birth
,
AgeCategory
category
){
this
.
FORENAME
=
forename
;
this
.
name
=
name
;
this
.
BIRTH
=
birth
;
this
.
category
=
category
;
}
Infant
(
String
forename
,
String
name
,
LocalDate
birth
){
this
.
FORENAME
=
forename
;
this
.
name
=
name
;
this
.
BIRTH
=
birth
;
this
.
category
=
AgeCategory
.
getInstance
(
birth
);
}
}
\ 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