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
Hide 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,22 +14,45 @@ public class App {
...
@@ -14,22 +14,45 @@ public class App {
System
.
out
.
println
(
"On holiday"
);
System
.
out
.
println
(
"On holiday"
);
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
circumference
(
int
radius
)
throws
Exception
{
double
approxPI
=
3.14
;
//Ex1.5
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
greetingString
=
"Hello "
;
//Ex1.7
String
introductionString
=
"My name is Inigo Montoya "
;
//Ex1.8
String
introductionString
=
"My name is Inigo Montoya "
;
//Ex1.8
String
reminderString
=
"You killed my father "
;
//Ex1.9
String
reminderString
=
"You killed my father "
;
//Ex1.9
String
threatString
=
"Prepare to die!"
;
//Ex1.10
String
threatString
=
"Prepare to die!"
;
//Ex1.10
System
.
out
.
println
(
greetingString
+
introductionString
+
reminderString
+
threatString
);
//Ex1.11
if
(
numFingers
==
6
){
int
fingersOnRightHand
=
6
;
return
(
greetingString
+
introductionString
+
reminderString
+
threatString
);
//Ex1.11
if
(
fingersOnRightHand
==
6
){
System
.
out
.
println
(
fingersOnRightHand
);
}
}
else
{
else
{
System
.
out
.
printl
n
(
"I am searching for the man who killed my father"
);
retur
n
(
"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
;
int
month
=
0
;
for
(
month
=
1
;
month
<
14
;
month
++){
for
(
month
=
1
;
month
<
14
;
month
++){
switch
(
month
){
switch
(
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