Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab Week 2
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
a-j.towse
Lab Week 2
Commits
1d45eca2
Commit
1d45eca2
authored
Feb 14, 2022
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Task 1-10
parent
6ea1f658
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
App.java
src/App.java
+31
-8
No files found.
src/App.java
View file @
1d45eca2
...
...
@@ -14,21 +14,44 @@ public class App {
System
.
out
.
println
(
"On holiday"
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
double
approxPI
=
3.14
;
//Ex1.5
public
static
void
circumference
(
int
radius
)
throws
Exception
{
double
approxPI
=
3.14
;
double
circ
=
((
radius
*
2
)
*
approxPI
);
System
.
out
.
println
(
circ
);
}
public
static
String
inigoSpeech
(
int
numFingers
){
String
greetingString
=
"Hello "
;
//Ex1.7
String
introductionString
=
"My name is Inigo Montoya "
;
//Ex1.8
String
reminderString
=
"You killed my father "
;
//Ex1.9
String
threatString
=
"Prepare to die!"
;
//Ex1.10
System
.
out
.
println
(
greetingString
+
introductionString
+
reminderString
+
threatString
);
//Ex1.11
int
fingersOnRightHand
=
6
;
if
(
fingersOnRightHand
==
6
){
System
.
out
.
println
(
fingersOnRightHand
);
if
(
numFingers
==
6
){
return
(
greetingString
+
introductionString
+
reminderString
+
threatString
);
//Ex1.11
}
else
{
System
.
out
.
println
(
"I am searching for the man who killed my father"
);
return
(
"I am searching for the man who killed my father"
);
}
}
public
static
boolean
isItALeapYear
(
int
year
){
if
(((
year
%
4
)
==
0
)
&&
((
year
%
100
)
!=
0
))
{
return
(
true
);
}
else
if
(((
year
%
4
)
==
0
)
&&
((
year
%
100
)
==
0
)
&&
((
year
%
400
)
==
0
)){
return
(
true
);
}
else
{
return
(
false
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
countDays
();
circumference
(
10
);
inigoSpeech
(
6
);
isItALeapYear
(
2016
);
int
month
=
0
;
for
(
month
=
1
;
month
<
14
;
month
++){
...
...
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