Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohj2
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vvlaspa
ohj2
Commits
fdc7383c
Commit
fdc7383c
authored
1 month ago
by
Läspä Vili Valtteri
Browse files
Options
Downloads
Patches
Plain Diff
Alustava Puntti luokka tehty
parent
e86383a1
Branches
main
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
puntti/src/puntti/Puntti.java
+94
-0
94 additions, 0 deletions
puntti/src/puntti/Puntti.java
puntti/src/puntti/SailoException.java
+5
-0
5 additions, 0 deletions
puntti/src/puntti/SailoException.java
with
99 additions
and
0 deletions
puntti/src/puntti/Puntti.java
0 → 100644
+
94
−
0
View file @
fdc7383c
/**
*
*/
package
puntti
;
/**
* |------------------------------------------------------------------------|
* | Luokan nimi: Puntti | Avustajat: |
* |-------------------------------------------------------------------------
* | Vastuualueet: | |
* | | - Liikkeet |
* | - Huolehtii Liikkeet ja Tulokset -luokkien | - Tulos |
* | välisestä yhteistyöstä ja välittää näitä tietoja | - Liike |
* | pyydettäessä | - Tulokset |
* | - lukee ja kirjoittaa kerhon tiedostoon pyytämällä | |
* | apuja avustajiltaan | |
* |-------------------------------------------------------------------------
*
* @author laspa
* @version 5.3.2025
*
*/
public
class
Puntti
{
Liikkeet
liikkeet
=
new
Liikkeet
();
/**
* Palautaa punti nliikkeiden määrän
* @return liikemäärän
*/
public
int
getLiikkeita
()
{
return
liikkeet
.
getLkm
();
}
/**
* Lisätään uusi liike
* @param liike lisättävä liike
* @throws SailoException kun lisääminen ei onnistu
*/
public
void
lisaa
(
Liike
liike
)
throws
SailoException
{
liikkeet
.
lisaa
(
liike
);
}
/**
* Palauttaa i:n liikkeen
* @param i mones liike palautetaan
* @return viite i:teen liikkeeseen
* @throws IndexOutOfBoundsException jos i on epäsopiva
*/
public
Liike
annaLiike
(
int
i
)
{
return
liikkeet
.
anna
(
i
);
}
/**
* @param args ei käytössä
*/
public
static
void
main
(
String
[]
args
)
{
Puntti
puntti
=
new
Puntti
();
Liike
kyykky
=
new
Liike
();
Liike
kyykky2
=
new
Liike
();
kyykky
.
lisaaLiike
();
kyykky
.
taytaKyykky
();
kyykky2
.
lisaaLiike
();
kyykky2
.
taytaKyykky
();
try
{
puntti
.
lisaa
(
kyykky
);
puntti
.
lisaa
(
kyykky2
);
puntti
.
lisaa
(
kyykky
);
puntti
.
lisaa
(
kyykky2
);
puntti
.
lisaa
(
kyykky
);
puntti
.
lisaa
(
kyykky2
);
}
catch
(
SailoException
e
)
{
System
.
err
.
println
(
e
.
getMessage
());
}
for
(
int
i
=
0
;
i
<
puntti
.
getLiikkeita
();
i
++)
{
Liike
liike
=
puntti
.
annaLiike
(
i
);
System
.
out
.
println
(
"Liike indeksi "
+
i
);
liike
.
tulosta
(
System
.
out
);
}
}
}
This diff is collapsed.
Click to expand it.
puntti/src/puntti/SailoException.java
+
5
−
0
View file @
fdc7383c
package
puntti
;
package
puntti
;
/**
* @author laspa
* @version 5.3.2025
*
*/
public
class
SailoException
extends
Exception
{
public
class
SailoException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
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