class Customer
@@no_of_customers = 0
def initialize(id, name, addr)
@@no_of_customers += 1
@cust_id = id
@cust_name = name
@cust_addr = addr
end
def display_details()
puts "Customer id #@cust_id"
puts "Customer name #@cust_name"
puts "Customer address #@cust_addr"
end
def total_no_of_customers()
puts "Total number of customers: #@@no_of_customers"
end
end
# Create Objects
cust1 = Customer.new("1", "John", "GuangXi,NanNing")
cust2 = Customer.new("2", "Poul", "GuangDong,ShenZhen")
# Call Methods
cust1.display_details()
cust1.total_no_of_customers()
cust2.display_details()
cust2.total_no_of_customers()
Customer.new("3", "Raghu", "JiangSu,NanJing")
cust4 = Customer.new("4", "Rahman", "HuBei,WuHan")
cust4.total_no_of_customers()