Skip to content

This Swift code defines a class called ExchangeRate which represents an exchange rate between two currencies. It has four properties: fromCurrency and toCurrency are strings representing the currencies being exchanged, baseAmount is an unsigned integer representing the amount of the base currency being exchanged, and rate is a floating point ...

License

guillaumelauzier/Exchange-Rate-Board

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Exchange-Rate-Board

This Swift code defines a class called ExchangeRate which represents an exchange rate between two currencies. It has four properties: fromCurrency and toCurrency are strings representing the currencies being exchanged, baseAmount is an unsigned integer representing the amount of the base currency being exchanged, and rate is a floating point number representing the exchange rate.

The class has an initializer method that takes in four parameters - the from currency, the to currency, the base amount, and the exchange rate. The initializer sets the class properties with these values.

The class also has a computed property called description which returns a string representation of the exchange rate, including the baseAmount, fromCurrency, rate, and toCurrency.

The code then creates instances of the ExchangeRate class and adds them to an array called exchangeRateTable. The exchangeRateTable array contains a list of exchange rates between various currencies.

Finally, the code loops through the exchangeRateTable array and prints the description of each ExchangeRate instance in the array.

About

This Swift code defines a class called ExchangeRate which represents an exchange rate between two currencies. It has four properties: fromCurrency and toCurrency are strings representing the currencies being exchanged, baseAmount is an unsigned integer representing the amount of the base currency being exchanged, and rate is a floating point ...

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published