forked from IF-LK-2020/wordle
finished user class
This commit is contained in:
@@ -10,7 +10,7 @@ public class User
|
||||
private String name;
|
||||
private String password;
|
||||
private int timesPlayed;
|
||||
private int winPercentage;
|
||||
private float winPercentage;
|
||||
private int currentStreak;
|
||||
private int maxStreak;
|
||||
private int[] wonInTurn;
|
||||
@@ -40,7 +40,7 @@ public class User
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
// tragen Sie hier den Code ein
|
||||
@@ -50,7 +50,7 @@ public class User
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTimesPlayed(int timesPlayed)
|
||||
{
|
||||
@@ -63,17 +63,32 @@ public class User
|
||||
return timesPlayed;
|
||||
}
|
||||
|
||||
public void setwinPercentage(int winPercentage)
|
||||
public void increaseTimesPlayed()
|
||||
{
|
||||
timesPlayed = timesPlayed + 1;
|
||||
}
|
||||
|
||||
public void setwinPercentage(float winPercentage)
|
||||
{
|
||||
// tragen Sie hier den Code ein
|
||||
this.winPercentage = winPercentage;
|
||||
}
|
||||
|
||||
public int getWinPercentage()
|
||||
public float getWinPercentage()
|
||||
{
|
||||
return winPercentage;
|
||||
}
|
||||
|
||||
public void calculateWinPercentage()
|
||||
{
|
||||
int sum = 0;
|
||||
for(int i = 0;i < wonInTurn.length;i++)
|
||||
{
|
||||
sum += wonInTurn[i];
|
||||
}
|
||||
winPercentage = sum / timesPlayed;
|
||||
}
|
||||
|
||||
public void setCurrentStreak(int currentStreak)
|
||||
{
|
||||
// tragen Sie hier den Code ein
|
||||
@@ -85,9 +100,13 @@ public class User
|
||||
return currentStreak;
|
||||
}
|
||||
|
||||
public void increaseCurrentStreak()
|
||||
{
|
||||
currentStreak = currentStreak + 1;
|
||||
}
|
||||
|
||||
public void setMaxStreak(int maxStreak)
|
||||
{
|
||||
// tragen Sie hier den Code ein
|
||||
this.maxStreak = maxStreak;
|
||||
}
|
||||
|
||||
@@ -96,6 +115,11 @@ public class User
|
||||
return maxStreak;
|
||||
}
|
||||
|
||||
public void increaseMaxStreak()
|
||||
{
|
||||
maxStreak = maxStreak + 1;
|
||||
}
|
||||
|
||||
public void setWonInTurn(int[] wonInTurn)
|
||||
{
|
||||
this.wonInTurn = wonInTurn;
|
||||
@@ -105,8 +129,10 @@ public class User
|
||||
{
|
||||
int temp = wonInTurn[turn];
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void increaseWonInTurn()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user