Untitled
unknown
ruby
3 years ago
1.7 kB
2
Indexable
# Define the Country class class Country # Define the initialize method for the Country class def initialize(name, tax_vat_rate) @name = name @tax_vat_rate = tax_vat_rate end # Define getters for the name and tax VAT rate attributes attr_reader :name, :tax_vat_rate end # Define the Enum class class Enum # Define the initialize method for the Enum class def initialize(values) @values = values end # Define the each method for the Enum class def each @values.each do |value| yield(value) end end end # Create an array of Country objects for each European country european_countries = [ Country.new("United Kingdom", 0.2), Country.new("Germany", 0.19), Country.new("France", 0.2), Country.new("Spain", 0.21), Country.new("Italy", 0.22), Country.new("Netherlands", 0.21), Country.new("Belgium", 0.21), Country.new("Luxembourg", 0.17), Country.new("Austria", 0.2), Country.new("Bulgaria", 0.2), Country.new("Croatia", 0.25), Country.new("Cyprus", 0.19), Country.new("Czech Republic", 0.21), Country.new("Denmark", 0.25), Country.new("Estonia", 0.2), Country.new("Finland", 0.24), Country.new("Greece", 0.24), Country.new("Hungary", 0.27), Country.new("Ireland", 0.23), Country.new("Latvia", 0.21), Country.new("Lithuania", 0.21), Country.new("Malta", 0.18), Country.new("Poland", 0.23), Country.new("Portugal", 0.23), Country.new("Romania", 0.19), Country.new("Slovakia", 0.2), Country.new("Slovenia", 0.22), Country.new("Sweden", 0.25), Country.new("Iceland", 0.24), Country.new("Norway", 0.25), Country.new("Switzerland", 0.08), Country.new("Liechtenstein", 0.08), Country.new("Montenegro", 0.21), Country.new("Serbia", 0.20),
Editor is loading...