forked from IF-LK-2020/wordle
141 lines
2.7 KiB
Java
141 lines
2.7 KiB
Java
/**
|
|
* Beschreiben Sie hier die Klasse User.
|
|
*
|
|
* @author (Ihr Name)
|
|
* @version (eine Versionsnummer oder ein Datum)
|
|
*/
|
|
public class Guest
|
|
{
|
|
// Instanzvariablen - ersetzen Sie das folgende Beispiel mit Ihren Variablen
|
|
private String name;
|
|
private String password;
|
|
private float winPercentage;
|
|
private int timesPlayed;
|
|
private int currentStreak;
|
|
private int maxStreak;
|
|
private int[] wonInTurn = {0,0,0,0,0,0};
|
|
|
|
/**
|
|
* Konstruktor für Objekte der Klasse User
|
|
*/
|
|
public Guest()
|
|
{
|
|
// Instanzvariable initialisieren
|
|
|
|
}
|
|
|
|
|
|
public void setPassword(String password)
|
|
{
|
|
// tragen Sie hier den Code ein
|
|
this.password = password;
|
|
}
|
|
|
|
public String getPassword()
|
|
{
|
|
return password;
|
|
}
|
|
|
|
|
|
public void setName(String name)
|
|
{
|
|
// tragen Sie hier den Code ein
|
|
this.name = name;
|
|
}
|
|
|
|
public String getName()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
|
|
public void setWinPercentage(float winPercentage)
|
|
{
|
|
// tragen Sie hier den Code ein
|
|
this.winPercentage = winPercentage;
|
|
}
|
|
|
|
public float getWinPercentage()
|
|
{
|
|
int sum = 0;
|
|
for(int i = 0;i < wonInTurn.length;i++)
|
|
{
|
|
sum += wonInTurn[i];
|
|
}
|
|
winPercentage = sum / timesPlayed;
|
|
return winPercentage;
|
|
}
|
|
|
|
|
|
public void setTimesPlayed(int timesPlayed)
|
|
{
|
|
// tragen Sie hier den Code ein
|
|
this.timesPlayed = timesPlayed;
|
|
}
|
|
|
|
public int getTimesPlayed()
|
|
{
|
|
return timesPlayed;
|
|
}
|
|
|
|
public void increaseTimesPlayed()
|
|
{
|
|
timesPlayed = timesPlayed + 1;
|
|
}
|
|
|
|
|
|
public void setCurrentStreak(int currentStreak)
|
|
{
|
|
// tragen Sie hier den Code ein
|
|
this.currentStreak = currentStreak;
|
|
}
|
|
|
|
public int getCurrentStreak()
|
|
{
|
|
return currentStreak;
|
|
}
|
|
|
|
public void increaseCurrentStreak()
|
|
{
|
|
currentStreak = currentStreak + 1;
|
|
}
|
|
|
|
|
|
public void setMaxStreak(int maxStreak)
|
|
{
|
|
this.maxStreak = maxStreak;
|
|
}
|
|
|
|
public int getMaxStreak()
|
|
{
|
|
return maxStreak;
|
|
}
|
|
|
|
public void increaseMaxStreak()
|
|
{
|
|
maxStreak = maxStreak + 1;
|
|
}
|
|
|
|
|
|
public void setWonInTurn(int row, int value)
|
|
{
|
|
this.wonInTurn[row] = value;
|
|
}
|
|
|
|
public int getWonInTurn(int row)
|
|
{
|
|
int temp = wonInTurn[row];
|
|
return temp;
|
|
}
|
|
|
|
public void increaseWonInTurn(int row)
|
|
{
|
|
int temp = getWonInTurn(row) + 1;
|
|
setWonInTurn(row, temp);
|
|
}
|
|
|
|
public int[] getWonInTurnFull()
|
|
{
|
|
return wonInTurn;
|
|
}
|
|
} |