private static void TampilData(List <Bola> bola, Bola volume) { Console.WriteLine("Tampilkan Semua Volume Bola"); int j = 1; foreach (Bola i in bola) { Console.WriteLine($"Bola ke-{j} | Jari-jari: {i.JariJari}"); Console.WriteLine($" Volume: {Convert.ToString(String.Format("{0:0.00}", volume.Volume(i.JariJari)))}"); Console.WriteLine(); j++; } }
static void Main(string[] args) { List <Bola> bola = new List <Bola>(); bola.Add(new Bola(3)); bola.Add(new Bola(4)); bola.Add(new Bola(5)); int i = 0; while (i == 0) { int option = TampilanMenu(); Bola volume = new Bola(); switch (option) { case 1: TambahData(bola); break; case 2: HapusData(bola); break; case 3: TampilData(bola, volume); break; case 4: i = Exit(i); break; default: break; } } }