Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
Week Two Exercises
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jinny.wilkin
Week Two Exercises
Commits
819394aa
Commit
819394aa
authored
Feb 14, 2022
by
jinny.wilkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added comments
parent
6b7cad1f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
App.class
bin/App.class
+0
-0
App.java
src/App.java
+6
-4
No files found.
bin/App.class
View file @
819394aa
No preview for this file type
src/App.java
View file @
819394aa
...
@@ -3,7 +3,7 @@ public class App {
...
@@ -3,7 +3,7 @@ public class App {
/* Week 2 Exercises
/* Week 2 Exercises
14/02 Jinny Wilkin */
14/02 Jinny Wilkin */
int
fingersOnRightHand
=
5
;
// Ex 4.1
//
int fingersOnRightHand = 5; // Ex 4.1
countDays
();
// Ex 8.1
countDays
();
// Ex 8.1
...
@@ -145,7 +145,7 @@ public class App {
...
@@ -145,7 +145,7 @@ public class App {
monthDo
++;
monthDo
++;
}
while
(
monthDo
<
14
);
}
while
(
monthDo
<
14
);
System
.
out
.
println
(
"There
are "
+
daysBetween
(
26
,
8
,
1996
,
14
,
2
,
2022
)
);
System
.
out
.
println
(
"There
have been "
+
daysBetween
(
26
,
8
,
1996
,
14
,
2
,
2022
)+
" days between the day I was born and the day I wrote this"
);
}
}
...
@@ -186,7 +186,7 @@ public class App {
...
@@ -186,7 +186,7 @@ public class App {
}
}
public
static
boolean
isItALeapYear
(
int
year
){
public
static
boolean
isItALeapYear
(
int
year
){
// Ex9
if
(
year
%
4
==
0
){
if
(
year
%
4
==
0
){
return
(
true
);
return
(
true
);
}
else
{
}
else
{
...
@@ -194,6 +194,8 @@ public class App {
...
@@ -194,6 +194,8 @@ public class App {
}
}
}
}
// Ex 10
public
static
int
daysInYear
(
int
year
){
public
static
int
daysInYear
(
int
year
){
if
(
isItALeapYear
(
year
)){
if
(
isItALeapYear
(
year
)){
return
(
366
);
return
(
366
);
...
...
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