static void Main(string[] args) { Console.WriteLine("======== MENGHITUNG BERAT BADAN IDEAL ========\n"); beratPriaWanita beratIdeal = new beratPriaWanita(); Console.Write("Jenis Kelamin : "); string jenis = Console.ReadLine(); if (jenis == "wanita") { Console.Write("Nama Anda : "); string nama = Console.ReadLine(); Console.Write("Tinggi badan Anda : "); double berat = beratIdeal.beratIdealWanita(double.Parse(Console.ReadLine())); Console.WriteLine("\nHai, " + nama + "!"); Console.WriteLine("Berat badan ideal Anda adalah " + berat + " kg."); } else if (jenis == "pria") { Console.Write("Nama Anda : "); string nama = Console.ReadLine(); Console.Write("Tinggi badan Anda : "); double berat = beratIdeal.beratIdealPria(double.Parse(Console.ReadLine())); Console.WriteLine("\nHai, " + nama + "!"); Console.WriteLine("Berat badan ideal Anda adalah " + berat + " kg."); } else { Console.WriteLine("undefined input"); } Console.ReadLine(); }
static void Main(string[] args) { beratPriaWanita bpw = new beratPriaWanita(); Console.WriteLine("================================"); Console.WriteLine("1. Berat Ideal Pria"); Console.WriteLine("2. Berat Ideal Wanita"); Console.WriteLine("Masukkan Menu Berat Ideal [1/2] = "); int input = int.Parse(Console.ReadLine()); Console.WriteLine("================================"); if (input == 1) { Console.WriteLine("======Berat Ideal Pria======"); bpw.beratIdealPria(); Console.WriteLine("============================"); } else if (input == 2) { Console.WriteLine("======Berat Ideal Wanita======"); bpw.beratIdealWanita(); Console.WriteLine("============================"); } else { Console.WriteLine("Menu Not Defined"); } }
static void Main(string[] args) { beratPriaWanita beratw = new beratPriaWanita(); Console.Write("Masukan Tinggi Badanmu (Wanita) :"); double a = Convert.ToDouble(Console.ReadLine()); beratw.beratIdealWanita(a); Console.ReadLine(); beratPriaWanita beratp = new beratPriaWanita(); Console.Write("Masukan Tinggi Badanmu (Pria) :"); double b = Convert.ToDouble(Console.ReadLine()); beratp.beratIdealPria(b); Console.ReadLine(); }