Methode spielzug() verändert

Parameter -> Scanner
This commit is contained in:
Malin.Sieckmann
2020-09-03 10:55:17 +02:00
parent dc4949b1cf
commit 7cdbe70838
3 changed files with 40 additions and 7 deletions

Binary file not shown.

View File

@@ -2,6 +2,14 @@
comment0.target=Spieler
comment1.params=pName
comment1.target=Spieler(java.lang.String)
comment2.params=pYKord\ pXKord
comment2.target=int[]\ spielzug(int,\ int)
numComments=3
comment2.params=
comment2.target=int[]\ spielzug()
comment3.params=pSiege
comment3.target=void\ setSiege(int)
comment4.params=pNiederlagen
comment4.target=void\ setNiederlagen(int)
comment5.params=
comment5.target=int\ getSiege()
comment6.params=
comment6.target=int\ getNiederlagen()
numComments=7

View File

@@ -1,15 +1,40 @@
import java.util.Scanner;
public class Spieler {
String name;
int siege;
int niederlagen;
int spielAnzahl;
Scanner konsole = new Scanner(System.in);
public Spieler(String pName) {
name = pName;
}
public int [] spielzug(int pYKord, int pXKord)
public int [] spielzug()
{
return new int[] {pYKord, pXKord};
int pXKord = konsole.nextInt();
int pYKord = konsole.nextInt();
return new int[] {pXKord, pYKord};
}
//Set-Methoden
public void setSiege(int pSiege)
{
siege = pSiege;
}
public void setNiederlagen(int pNiederlagen)
{
niederlagen = pNiederlagen;
}
//Get-Methoden
public int getSiege()
{
return siege;
}
public int getNiederlagen()
{
return niederlagen;
}
}