×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: Jan 18, 2021 10:09 AM
Views: 4664
Tags: method
  1. public int getTotalCapacity() {
  2.  
  3.         int total = 0;
  4.  
  5.         for (Disk n : disk) {
  6.             total += n.getTotalStorage();
  7.         }
  8.         return total;
  9.  
  10.     }
  11.  
  12.     public int getFreeCapacity(){
  13.         int free = 0;
  14.  
  15.         for (Disk n : disk) {
  16.             //1.0 - use weil wir wollen ja einen prozent satz am Ende haben!
  17.             //Summe des FREIEN Platzes auf allen Disks
  18.             free += n.getTotalStorage() * (1.0 - n.use);
  19.         }
  20.         return free;
  21.     }