Answer To: OPIM3220_HW3 OPIM XXXXXXXXXXHomework 3 The final homework for OPIM 3220 is more open ended than the...
Shivani answered on Apr 24 2021
Application_CurrencyConverter/CurrencyConverter/.vs/CurrencyConverter/DesignTimeBuild/.dtbcache.v2
Application_CurrencyConverter/CurrencyConverter/.vs/CurrencyConverter/v16/.suo
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CurrencyConverter", "CurrencyConverter\CurrencyConverter.csproj", "{8BBCAC68-F6F2-4A5B-A510-C5FE9D02D50C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8BBCAC68-F6F2-4A5B-A510-C5FE9D02D50C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BBCAC68-F6F2-4A5B-A510-C5FE9D02D50C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BBCAC68-F6F2-4A5B-A510-C5FE9D02D50C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BBCAC68-F6F2-4A5B-A510-C5FE9D02D50C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D846EF1A-8B3E-48DF-B048-3943B623F4AE}
EndGlobalSection
EndGlobal
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.deps.json
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"CurrencyConverter/1.0.0": {
"runtime": {
"CurrencyConverter.dll": {}
}
}
}
},
"libraries": {
"CurrencyConverter/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.dll
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.exe
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.pdb
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.runtimeconfig.dev.json
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Shivani\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Shivani\\.nuget\\packages"
]
}
}
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/bin/Debug/netcoreapp3.1/CurrencyConverter.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}
Application_CurrencyConverter/CurrencyConverter/CurrencyConverter/CurrencyConverter.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
namespace CurrencyConverter
{
class CurrencyConverter
{
public static string[] GetCurrencyShortCodes()
{
// The XML contains these currency tags and the program shall parse through these tags
return new string[] {"eur", "usd", "jpy", "bgn", "czk", "dkk", "gbp", "huf", "ltl", "lvl"
, "pln", "ron", "sek", "chf", "nok", "hrk", "rub", "try", "aud", "brl", "cad", "cny", "hkd", "idr", "ils"
, "inr", "krw", "mxn", "myr", "nzd", "php", "sgd", "zar"};
}
/// Get currency exchange rate in euro's
public static float GetCurrencyRateInEuro(string currency)
{
if (currency.ToLower() == "")
throw new ArgumentException("Invalid Argument! currency parameter cannot be empty!");
if (currency.ToLower() == "eur")
throw new ArgumentException("Invalid Argument! Cannot get exchange rate from EURO to EURO");
try
{
// Create with currency parameter, a valid RSS url to ECB euro exchange rate feed
string rssUrl = string.Concat("http://www.ecb.int/rss/fxref-", currency.ToLower() + ".html");
// Create & Load New Xml Document
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(rssUrl);
// Create XmlNamespaceManager for handling XML namespaces.
System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("rdf", "http://purl.org/rss/1.0/");
nsmgr.AddNamespace("cb", "http://www.cbwiki.net/wiki/index.php/Specification_1.1");
// Get list of daily currency exchange rate between selected "currency" and the EURO
System.Xml.XmlNodeList nodeList = doc.SelectNodes("//rdf:item", nsmgr);
// Loop Through all XMLNODES with daily exchange rates
foreach (System.Xml.XmlNode node in nodeList)
{
// Create a CultureInfo, this is because EU and USA use different sepperators in float (, or .)
CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
ci.NumberFormat.CurrencyDecimalSeparator = ".";
try
{
// Get currency exchange rate with EURO from XMLNODE
float exchangeRate = float.Parse(
...