Skip to content

Commit

Permalink
Update MainView.java
Browse files Browse the repository at this point in the history
add default values
  • Loading branch information
Pythaeus by MuFa committed Jun 17, 2022
1 parent 8dbc829 commit c7b1d6d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/de/musti/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private static double stringToNumber(String inputs) {
try {
d = Double.parseDouble(removeComma(inputs));
}catch(NumberFormatException e) {
d = 0.0f;
d = 0.0;
}
return d;
}
Expand All @@ -235,29 +235,29 @@ private static String formatStringTwoComma(double s) {

private static double getHours() {
double h = stringToNumber(MainView.textField_time.getText());
if(h < 25.0f & h > 0.0f)
if(h < 25.0 & h > 0.0)
return h/24*100;
else
MainView.textField_time.setText("24");
return 0.0f;
return 24/24*100;
}

private static double getCent() {
double c = stringToNumber(MainView.textField_price.getText());
if(c > 0 & c < 10000f)
if(c > 0 & c < 10000)
return c/100;
else
MainView.textField_price.setText("1");
return 0.0f;
MainView.textField_price.setText("30");
return 30/100;
}

private static double getWatt() {
double w = stringToNumber(MainView.textField_watt.getText());
if(w > 0 & w < 1000000f)
if(w > 0 & w < 1000000)
return w;
else
MainView.textField_watt.setText("1");
return 0.0f;
return 1;
}

private static double getWattHours() {
Expand Down

0 comments on commit c7b1d6d

Please sign in to comment.