Commit d3ced366 authored by Peining's avatar Peining

add conservation of decimal

parent 6ff43a96
...@@ -15,6 +15,7 @@ import java.text.SimpleDateFormat; ...@@ -15,6 +15,7 @@ import java.text.SimpleDateFormat;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Formatter;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -33,8 +34,6 @@ import javafx.scene.control.DatePicker; ...@@ -33,8 +34,6 @@ import javafx.scene.control.DatePicker;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane; import javafx.scene.layout.Pane;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
...@@ -241,6 +240,7 @@ public class PlayerProfileController extends AbstractController{ ...@@ -241,6 +240,7 @@ public class PlayerProfileController extends AbstractController{
if (data.get(3)!=0){ if (data.get(3)!=0){
rate = ((double)data.get(0))/((double)data.get(3))*100; rate = ((double)data.get(0))/((double)data.get(3))*100;
} }
new Formatter().format("%.2f", rate);
rateBelgian.setText("win rate: "+rate+"%"); rateBelgian.setText("win rate: "+rate+"%");
} }
return data; return data;
...@@ -256,6 +256,7 @@ public class PlayerProfileController extends AbstractController{ ...@@ -256,6 +256,7 @@ public class PlayerProfileController extends AbstractController{
if (data.get(3)!=0){ if (data.get(3)!=0){
rate = ((double)data.get(0))/((double)data.get(3))*100; rate = ((double)data.get(0))/((double)data.get(3))*100;
} }
new Formatter().format("%.2f", rate);
rateAll.setText("win rate: "+rate+"%"); rateAll.setText("win rate: "+rate+"%");
return data; return data;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment