- static methods above instance methods
- consistent spelling
This commit is contained in:
		@@ -25,11 +25,20 @@ public class DrinkingBar extends AbstractLoadingBar {
 | 
				
			|||||||
   private static final BigDecimal DEFAULT_TOTAL_TIME_BD = BigDecimal.valueOf(DEFAULT_TOTAL_TIME);
 | 
					   private static final BigDecimal DEFAULT_TOTAL_TIME_BD = BigDecimal.valueOf(DEFAULT_TOTAL_TIME);
 | 
				
			||||||
   private static final BigDecimal DEFAULT_TOTAL_LITRES = BigDecimal.valueOf(2.0);
 | 
					   private static final BigDecimal DEFAULT_TOTAL_LITRES = BigDecimal.valueOf(2.0);
 | 
				
			||||||
   private static final BigDecimal QUARTER_LITRE = BigDecimal.valueOf(0.25);
 | 
					   private static final BigDecimal QUARTER_LITRE = BigDecimal.valueOf(0.25);
 | 
				
			||||||
   private static final DecimalFormat LITER_FORMAT = new DecimalFormat("0.00");
 | 
					   private static final DecimalFormat LITRE_FORMAT = new DecimalFormat("0.00");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   private BigDecimal totalLitres;
 | 
					   private BigDecimal totalLitres;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   public static void main(String[] args) throws IOException {
 | 
				
			||||||
 | 
					      var br = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
 | 
				
			||||||
 | 
					      print("Ankunftszeit: ");
 | 
				
			||||||
 | 
					      var startTime = LocalTime.parse(br.readLine(), FormatTools.TIME_FORMATTER).truncatedTo(ChronoUnit.MINUTES);
 | 
				
			||||||
 | 
					      var db = new DrinkingBar(startTime);
 | 
				
			||||||
 | 
					      db.showLoadingBar();
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   protected DrinkingBar(LocalTime startTime) {
 | 
					   protected DrinkingBar(LocalTime startTime) {
 | 
				
			||||||
      super(startTime, DEFAULT_TOTAL_TIME);
 | 
					      super(startTime, DEFAULT_TOTAL_TIME);
 | 
				
			||||||
      this.totalLitres = DEFAULT_TOTAL_LITRES;
 | 
					      this.totalLitres = DEFAULT_TOTAL_LITRES;
 | 
				
			||||||
@@ -52,15 +61,6 @@ public class DrinkingBar extends AbstractLoadingBar {
 | 
				
			|||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   public static void main(String[] args) throws IOException {
 | 
					 | 
				
			||||||
      var br = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
 | 
					 | 
				
			||||||
      print("Ankunftszeit: ");
 | 
					 | 
				
			||||||
      var startTime = LocalTime.parse(br.readLine(), FormatTools.TIME_FORMATTER).truncatedTo(ChronoUnit.MINUTES);
 | 
					 | 
				
			||||||
      var db = new DrinkingBar(startTime);
 | 
					 | 
				
			||||||
      db.showLoadingBar();
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   @Override
 | 
					   @Override
 | 
				
			||||||
   protected String fillLoadingBar(long passedMinutes, boolean progressive) {
 | 
					   protected String fillLoadingBar(long passedMinutes, boolean progressive) {
 | 
				
			||||||
      long effectivePassedMinutes = passedMinutes < 0 ? 0 : passedMinutes;
 | 
					      long effectivePassedMinutes = passedMinutes < 0 ? 0 : passedMinutes;
 | 
				
			||||||
@@ -78,7 +78,7 @@ public class DrinkingBar extends AbstractLoadingBar {
 | 
				
			|||||||
         .divide(QUARTER_LITRE, MathContext.DECIMAL64); */
 | 
					         .divide(QUARTER_LITRE, MathContext.DECIMAL64); */
 | 
				
			||||||
      BigDecimal minutesToNextStep = getMinutesToNextStep(currentLitres);
 | 
					      BigDecimal minutesToNextStep = getMinutesToNextStep(currentLitres);
 | 
				
			||||||
      String progressivePart = progressive ? "\r" : "";
 | 
					      String progressivePart = progressive ? "\r" : "";
 | 
				
			||||||
      return progressivePart + "Aktuelles Volumen: " + LITER_FORMAT.format(printedLitres) + "L - "
 | 
					      return progressivePart + "Aktuelles Volumen: " + LITRE_FORMAT.format(printedLitres) + "L - "
 | 
				
			||||||
         // + FormatTools.PERCENTAGE_FORMAT.format(currentProgressToNextStep) + "% - "
 | 
					         // + FormatTools.PERCENTAGE_FORMAT.format(currentProgressToNextStep) + "% - "
 | 
				
			||||||
         + FormatTools.minutesToTimeString(minutesToNextStep);
 | 
					         + FormatTools.minutesToTimeString(minutesToNextStep);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user