Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SU1_Workshop_testing_2017
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Grethe Sandstrak
SU1_Workshop_testing_2017
Commits
d4a0ba0b
Commit
d4a0ba0b
authored
7 years ago
by
Grethe Sandstrak
Browse files
Options
Downloads
Patches
Plain Diff
Replace Land.java
parent
27ded073
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
kodeforst/Land.java
+4
-3
4 additions, 3 deletions
kodeforst/Land.java
with
4 additions
and
3 deletions
kodeforst/Land.java
+
4
−
3
View file @
d4a0ba0b
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
private
String
statsoverhode
;
private
String
statsoverhode
;
private
By
[]
byer
;
// hovedstad indeks 0
private
By
[]
byer
;
// hovedstad indeks 0
private
int
antallbyer
=
0
;
private
int
antallbyer
=
0
;
private
static
final
long
serialVersionUID
=
101
;
public
Land
(
String
navn
,
String
statsoverhode
,
int
maksAntallByer
)
{
public
Land
(
String
navn
,
String
statsoverhode
,
int
maksAntallByer
)
{
this
.
navn
=
navn
;
this
.
navn
=
navn
;
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
public
void
setStatsoverhode
(
String
newValue
)
{
statsoverhode
=
newValue
;
}
public
void
setStatsoverhode
(
String
newValue
)
{
statsoverhode
=
newValue
;
}
public
String
toString
()
{
public
String
toString
()
{
String
res
=
navn
+
", Statsoverhode: "
+
statsoverhode
+
"\n Byer:\n---------------------\n"
;
String
res
=
navn
+
", Statsoverhode: "
+
navn
+
"\n Byer:\n---------------------\n"
;
for
(
By
b
:
byer
)
{
for
(
By
b
:
byer
)
{
if
(
b
!=
null
)
res
+=
b
+
"\n"
;
if
(
b
!=
null
)
res
+=
b
+
"\n"
;
}
}
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
public
int
getAntallInnbyggere
()
{
public
int
getAntallInnbyggere
()
{
int
antall
=
0
;
int
antall
=
0
;
for
(
int
i
=
0
;
i
<
antallbyer
;
i
++)
{
for
(
int
i
=
0
;
i
<
antallbyer
;
i
++)
{
antall
+
=
byer
[
i
].
getAntallInnbyggere
();
antall
=
byer
[
i
].
getAntallInnbyggere
();
}
}
return
antall
;
return
antall
;
}
}
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
}
}
return
ordfrere
;
return
ordfrere
;
}
}
public
String
[]
getSortertOrdfrerListe
()
{
public
String
[]
getSortertOrdfrerListe
()
{
String
[]
ordfrere
=
getOrdfrere
();
String
[]
ordfrere
=
getOrdfrere
();
for
(
int
start
=
0
;
start
<
ordfrere
.
length
;
start
++){
for
(
int
start
=
0
;
start
<
ordfrere
.
length
;
start
++){
...
...
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