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;
|
||||
@@ -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;
|
||||
@@ -107,6 +131,8 @@ public class User
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void increaseWonInTurn()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,92 +5,107 @@ dependency1.type=UsesDependency
|
||||
dependency2.from=DatabaseConnector
|
||||
dependency2.to=Queue
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=Game
|
||||
dependency3.to=WordleServer
|
||||
dependency3.from=Server
|
||||
dependency3.to=List
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=Game
|
||||
dependency4.to=User
|
||||
dependency4.from=WordleServer
|
||||
dependency4.to=List
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=Game
|
||||
dependency5.to=GUI
|
||||
dependency5.from=WordleServer
|
||||
dependency5.to=Game
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=Game
|
||||
dependency6.from=WordleServer
|
||||
dependency6.to=DatabaseConnector
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=Server
|
||||
dependency7.to=List
|
||||
dependency7.from=Game
|
||||
dependency7.to=WordleServer
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=WordleServer
|
||||
dependency8.to=DatabaseConnector
|
||||
dependency8.from=Game
|
||||
dependency8.to=User
|
||||
dependency8.type=UsesDependency
|
||||
objectbench.height=192
|
||||
objectbench.width=2536
|
||||
dependency9.from=Game
|
||||
dependency9.to=DatabaseConnector
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=1026
|
||||
editor.fx.0.width=1696
|
||||
editor.fx.0.x=-8
|
||||
editor.fx.0.y=-8
|
||||
objectbench.height=194
|
||||
objectbench.width=1656
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8477429227237949
|
||||
package.editor.height=1101
|
||||
package.editor.width=2446
|
||||
package.divider.vertical=0.7829373650107991
|
||||
package.editor.height=718
|
||||
package.editor.width=1545
|
||||
package.editor.x=0
|
||||
package.editor.y=0
|
||||
package.frame.height=1407
|
||||
package.frame.width=2576
|
||||
package.numDependencies=8
|
||||
package.numTargets=9
|
||||
package.frame.height=1026
|
||||
package.frame.width=1696
|
||||
package.numDependencies=9
|
||||
package.numTargets=10
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=windows-1252
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=DatabaseConnector
|
||||
target1.name=Letter
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=150
|
||||
target1.x=80
|
||||
target1.y=180
|
||||
target1.width=120
|
||||
target1.x=70
|
||||
target1.y=10
|
||||
target10.height=70
|
||||
target10.name=Queue
|
||||
target10.showInterface=false
|
||||
target10.type=ClassTarget
|
||||
target10.width=160
|
||||
target10.x=330
|
||||
target10.y=530
|
||||
target2.height=70
|
||||
target2.name=QueryResult
|
||||
target2.name=DatabaseConnector
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=730
|
||||
target2.width=150
|
||||
target2.x=80
|
||||
target2.y=180
|
||||
target3.height=70
|
||||
target3.name=Game
|
||||
target3.name=QueryResult
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=300
|
||||
target3.y=380
|
||||
target3.x=730
|
||||
target3.y=180
|
||||
target4.height=70
|
||||
target4.name=User
|
||||
target4.name=Game
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=1000
|
||||
target4.y=180
|
||||
target4.x=300
|
||||
target4.y=380
|
||||
target5.height=70
|
||||
target5.name=Server
|
||||
target5.name=User
|
||||
target5.showInterface=false
|
||||
target5.type=AbstractTarget
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=490
|
||||
target5.y=280
|
||||
target5.x=1000
|
||||
target5.y=180
|
||||
target6.height=70
|
||||
target6.name=WordleServer
|
||||
target6.name=Server
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.type=AbstractTarget
|
||||
target6.width=120
|
||||
target6.x=720
|
||||
target6.y=480
|
||||
target6.x=490
|
||||
target6.y=280
|
||||
target7.height=70
|
||||
target7.name=GUI
|
||||
target7.name=WordleServer
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=660
|
||||
target7.y=710
|
||||
target7.x=720
|
||||
target7.y=480
|
||||
target8.height=70
|
||||
target8.name=List
|
||||
target8.showInterface=false
|
||||
@@ -99,9 +114,9 @@ target8.width=150
|
||||
target8.x=980
|
||||
target8.y=380
|
||||
target9.height=70
|
||||
target9.name=Queue
|
||||
target9.name=GUI
|
||||
target9.showInterface=false
|
||||
target9.type=ClassTarget
|
||||
target9.width=160
|
||||
target9.x=330
|
||||
target9.y=530
|
||||
target9.width=120
|
||||
target9.x=200
|
||||
target9.y=10
|
||||
|
||||
Reference in New Issue
Block a user