Bạn thử xem code này nhé:
Mã nguồn PHP:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ClassPTIENVANTAI{ class Program { class PTVanTai { protected string tenkhach; protected string socmdn; public string loaixe; public string xe1 = "XeDap"; public string xe2 = "XeMay"; protected DateTime Ngaythue; protected int sogiothue; protected int SOGIOTHUE { get { return sogiothue; } set { sogiothue = value; } } protected string TENKHACH { get { return tenkhach; } set { tenkhach = value; } } protected DateTime NGAYGIOTHUE { get { return Ngaythue; } set { Ngaythue = value; } } public string SOCMND { get { return socmdn; } set { socmdn = value; } } public void Nhap1() { Console.Write("Ten KH: "); tenkhach = Console.ReadLine(); Console.Write("So Gio Thue Xe: "); sogiothue = Convert.ToInt32(Console.ReadLine()); Console.Write("So CMND: "); socmdn = Console.ReadLine(); Console.Write("Ngay Thue: "); Ngaythue = DateTime.Parse(Console.ReadLine()); } } class XEDAP : PTVanTai { public int tien; public int tongtien1(int giothue) { XEDAP x = new XEDAP(); if (giothue > 1) { x.tien = 20000 + giothue * 10000; } else if (giothue <= 1 &&giothue > 0) { x.tien = 20000; } else return x.tien; } public void Nhap2() { base.Nhap1(); } protected void Xuat1() { Console.Write("Ten KH: " + TENKHACH); Console.Write("So Gio Thue Xe: " + SOGIOTHUE); Console.Write("So CMND: " + SOCMND); Console.Write("Ngay cho thue: " + NGAYGIOTHUE); Console.Write("Tong Tien: "); tongtien1(sogiothue); } class XEMAY : PTVanTai { public int phankhoixe; public string biensoxe; public decimal tien2; public int PHANKHOIXE { get { return phankhoixe; } set { phankhoixe = value; } } public string BIENSOXE { get { return biensoxe; } set { biensoxe = value; } } public void Nhap3() { base.Nhap1(); Console.Write("Bien So: "); biensoxe = Console.ReadLine(); Console.Write("Phan khoi xe:"); phankhoixe = Convert.ToInt32(Console.ReadLine()); } protected void xuat3() { Console.Write("Ten KH: " + TENKHACH); Console.Write("So Gio Thue Xe: " + SOGIOTHUE); Console.Write("So CMND: " + SOCMND); Console.Write("Ngay cho thue: " + NGAYGIOTHUE); Console.Write("Bien so xe: " + BIENSOXE); Console.Write("Tien Thue: "); tongtien2(sogiothue); } public decimal tongtien2(decimal giothue2) { if (phankhoixe>100) { if(giothue2>1) tien2=80000+giothue2*50000; else if(giothue2>0&&giothue2<1) tien2=80000; else return tien2; } else if (phankhoixe<100) { if(giothue2>1) tien2=40000+giothue2*20000; else if(giothue2>0&&giothue2<1) tien2=40000; else return tien2; } } } static void Main(string[] args) { XEMAY[] KH = new XEMAY[100]; Console.Write("So Luong KH: "); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { KH[i] = new XEMAY(); Console.Write("------"); Console.Write("Khch Hang Thu: ", (i + 1)); KH[i].Nhap3(); } Console.Clear(); Console.WriteLine("-------- Danh Sach KH------------"); for (int i = 0; i < n; i++) { KH[i].Xuat3(); Console.WriteLine("---------------"); } Console.ReadLine(); } } }}
Không chỉ dừng lại ở việc sử dụng nguyên liệu cao cấp, mỗi công trình còn được "chăm sóc" bằng 4 dịch vụ xuất sắc của Tre Nghệ. Từ việc tư vấn, thiết kế đến thi công và hoàn thiện, mọi quy trình đều...
Chất Lượng và Sáng Tạo: Kiến Trúc...