static void Main(string[] args) { rectangle rec = new rectangle(); rec.initial(); Console.WriteLine("mianjiwei:{0}", rec.area()); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine(" ==================================="); Console.WriteLine(" === PERHITUNGAN KELILING ===="); Console.WriteLine(" ==================================="); Console.WriteLine(" ====== 1. Segitiga ======="); Console.WriteLine(" ====== 2. Lingkaran ======="); Console.WriteLine(" ====== 3. Persegi Panjang ======="); Console.WriteLine(" ========= 4. Trapesium ======="); Console.WriteLine(" ==================================="); Console.WriteLine(" === PILIHAN MENU : .... ===="); Console.WriteLine(" ==================================="); double nomor = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("===================================="); if (nomor == 1) { Console.WriteLine(); Console.Write("Masukkan sisi : "); double side = Convert.ToDouble(Console.ReadLine()); process p = new triangle(side); double l = p.processing(); Console.WriteLine("Keliling Segitiga : " + l); } else if (nomor == 2) { Console.Write("Masukkan jari-jari : "); double radius = Convert.ToDouble(Console.ReadLine()); process a = new circle(radius); double b = a.processing(); Console.WriteLine("Keliling Lingkaran : " + b); } else if (nomor == 3) { Console.Write("Masukkan panjang: "); double panjang = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan lebar : "); double lebar = Convert.ToDouble(Console.ReadLine()); process x = new rectangle(panjang, lebar); double y = x.processing(); Console.WriteLine("Keliling Persegi Panjang : " + y); } else { Console.Write("Masukkan side : "); double side = Convert.ToDouble(Console.ReadLine()); process m = new trapezoid(side); double n = m.processing(); Console.WriteLine("Keliling Trapesium : " + n); } Console.Read(); }
static void Main(string[] args) { rectangle four_ygl = new rectangle(5, 7); four_ygl.print_S(); square kvadr = new square(10); kvadr.print_S(); circle circ = new circle(33); circ.print_S(); Console.ReadKey(); }
static void Main(string[] args) { Shapes s = new Shapes(new Point2D()); s.centroid.x = 2; s.centroid.y = 3; circle c = new circle(new Point2D()); c.centroid.x = 1; c.centroid.y = -3; c.area = 5; rectangle r = new rectangle(new Point2D()); r.centroid.x = 0; Console.ReadLine(); }
static void Main(string[] args) { rectangle r1 = new rectangle(); Console.WriteLine("The rectangle has length, width " + r1.getLength() + "," + " " + r1.getWidth() + " " + "and area of " + r1.getArea() + " " + "Perimeter " + r1.Perimeter()); rectangle r2 = new rectangle(2, 6); Console.WriteLine("The rectangle has length, width " + r2.getLength() + "," + " " + r2.getWidth() + " " + "and area of " + r2.getArea() + " " + "Perimeter " + r2.Perimeter()); Employees e1 = new Employees(14027, "Hoang", "Trung", 12000000); Console.WriteLine("Employee " + "ID:" + e1.getID() + " " + "Name:" + e1.getName() + " " + "Salary:" + e1.getSalary() + " " + "Annual Salary:" + e1.getAnnualSalary() + " " + "Raise Salary:" + e1.raiseSalary(10)); Employees e2 = new Employees(22222, "Teo", "Kun", 10000000); Console.WriteLine("Employee " + "ID:" + e2.getID() + " " + "Name:" + e2.getName() + " " + "Salary:" + e2.getSalary() + " " + "Annual Salary:" + e2.getAnnualSalary() + " " + "Raise Salary:" + e2.raiseSalary(10)); }
static void Main(string[] args) { Console.WriteLine("=================================== :"); Console.WriteLine("PERHITUNGAN KELILING :"); Console.WriteLine("=================================== :"); Console.WriteLine("1. Segitiga :"); Console.WriteLine("2. Lingkaran :"); Console.WriteLine("3. Persegi Panjang :"); Console.WriteLine("4. Trapesium :"); Console.WriteLine("===================================="); Console.Write("Pilihan Menu :"); double nomor = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("===================================="); if (nomor == 1) { Console.WriteLine(); Console.Write("Masukkan sisi pertama : "); double side1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan sisi kedua : "); double side2 = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan sisi ketiga : "); double side3 = Convert.ToDouble(Console.ReadLine()); process p = new triangle(side1, side2, side3); double l = p.processing(); Console.WriteLine("Keliling Segitiga : " + l); } else if (nomor == 2) { Console.Write("Masukkan jari : "); double jari = Convert.ToDouble(Console.ReadLine()); process a = new circle(jari); double b = a.processing(); Console.WriteLine("Keliling Lingkaran : " + b); } else if (nomor == 3) { Console.Write("Masukkan panjang: "); double panjang = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan lebar : "); double lebar = Convert.ToDouble(Console.ReadLine()); process x = new rectangle(panjang, lebar); double y = x.processing(); Console.WriteLine("Keliling Persegi Panjang : " + y); } else { Console.Write("Masukkan side pertama: "); double sideA = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan side kedua : "); double sideB = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan side ketiga : "); double sideC = Convert.ToDouble(Console.ReadLine()); Console.Write("Masukkan side keempat : "); double sideD = Convert.ToDouble(Console.ReadLine()); process m = new trapezoid(sideA, sideB, sideC, sideD); double n = m.processing(); Console.WriteLine("Keliling Trapesium : " + n); } Console.Read(); }