Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use varieties of windows form tools/controls to design a windows application to

ID: 3601619 • Letter: U

Question

Use varieties of windows form tools/controls to design a windows application to perform buy and sell of multiple countries' currencies.  You should design your own windows form. Allow the options for choosing the exchange between the two selected countries' currencies and allow the buy or sell action.  Showing the exchange rates for buy and sell.  Allow the entering of the surrendered amount and display the exchanged resulting amount.  

The requirements for this assignment are:(1) allow choice of two countries, (2) allow buy or sell with exchange rates, (3) allow entering an amount for the transaction, (4) compute and display the result.

i need help fixing my C# code for a window app to converter.currency, the numbers converting the money is off for the 4 countries are off.


public partial class Form1 : Form
{
  
public Form1()
{
InitializeComponent();
}
string[] countries = new
string[] { "Euro dolla", "USA dollar", "belizen dollar", "Mexican peso",};
double[] sell = new double[] { 65, 1, 0.76, 1.25, 112.36 };
double[] buy = new double[] { 65.5, 1, 0.78, 1.3, 113.36 };
string country1, country2;
  
private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{
country1 = listBox1.GetItemText(listBox1.SelectedItem.ToString());
}

private void listBox2_SelectedIndexChanged_1(object sender, EventArgs e)
{
country2 = listBox2.GetItemText(listBox2.SelectedItem.ToString());
}

private void button1_Click(object sender, EventArgs e)
{
if(radioButton1.Checked == true)
{
double exchange = 1;
double finalValue = 1;
double val = double.Parse(textBox1.Text);
for (int i = 0; i < countries.Length; i++)
{
if (countries.ElementAt(i) == country1)
{
exchange = val / sell[i];
}
}
for (int i = 0; i < countries.Length; i++)
{
if (countries.ElementAt(i) == country2)
{
finalValue = exchange * sell[i];
}
}
textBox2.Text = finalValue.ToString();
}
if (radioButton2.Checked == true)
{
double exchange = 1;
double finalValue = 1;
double val = double.Parse(textBox1.Text);
for (int i = 0; i < countries.Length; i++)
{
if (countries.ElementAt(i) == country1)
{
exchange = val / buy[i];
}
}
for (int i = 0; i < countries.Length; i++)
{
if (countries.ElementAt(i) == country2)
{
finalValue = exchange * buy[i];
}
}
textBox2.Text = finalValue.ToString();
}
}

}
}

my forn design look like this

BuyingSelling Euro dollanT USA dollar Belize dollar Mexcio peso Euro dollam USA dollar Belize dollar Mexcio peso OF O Buy Sell Input: Output: Calculate

Explanation / Answer

Driver.java

--------------------------------------

import java.util.Scanner;

import java.io.*;

public class Driver

{

public static void main(String [] args)throws IOException

{

PrintWriter pw = new PrintWriter(new FileWriter("csis.txt"));

Xref foo = new Xref(pw);

Hash hash = new Hash(pw);

hash.getHashTable();

hash.printHashTable();

foo.getInfo();

foo.traverse();

foo.query();

pw.flush();

pw.close();

}

}

-------------------------------------------

Comparable.java

----------------------

public interface Comparable

{

int compareTo(Object o);

}

--------------------------------------------

Hash.java

--------------------

import java.io.*;

public class Hash

{

private int collisionCount;

ObjectList [] hashTable = new ObjectList [37];

PrintWriter pw;

public Hash(PrintWriter pw)

{

this.pw = pw;

}

public int getCollisionCount()

{

return collisionCount;

}

public ObjectList [] getHashTable()

{

String [] omitWord = {"a", "after", "all", "and", "because", "every", "for", "from", "had", "have", "in",

"is", "it", "its", "now", "of", "on", "so", "that", "the", "their", "there", "to",

"was", "were", "which", "with"};

collisionCount = 0;

for(int i = 0; i < omitWord.length; i++)

{

int hashValue = 0;

String tempString = omitWord[i];

char [] charArray;

charArray = tempString.toCharArray();

int sum = 0;

for(int n = 0; n < charArray.length; n++)

{

sum += charArray[n];

}

hashValue = sum % 37;

ObjectListNode node = new ObjectListNode();

Word temp = new Word(pw);

temp.setWord(omitWord[i]);

node.setInfo(temp);

ObjectList foo = new ObjectList();

if(hashTable[hashValue] != null)

{

collisionCount++;

foo = hashTable[hashValue];

foo.addLast(node);

hashTable[hashValue] = foo;

}

else if(hashTable[hashValue] == null)

{

foo.addLast(node);

hashTable[hashValue] = foo;

}

}

return hashTable;

}

public void printHashTable()

{

for(int i = 0; i < hashTable.length; i++)

{

if(hashTable[i] == null)

{

System.out.println("[" + i + "] = null");

pw.println("[" + i + "] = null");

}

else

{

ObjectList tempList = hashTable[i];

ObjectListNode tempNode = (ObjectListNode)tempList.getFirstNode();

System.out.print("[" + i + "] = ");

pw.print("[" + i + "] = ");

while(tempNode != null)

{

Word foo = (Word)tempNode.getInfo();

String word = foo.getWord();

System.out.print(word + " ");

pw.print(word + " ");

tempNode = tempNode.getNext();

}

System.out.println();

pw.println();

}

}

Hash foo = new Hash(pw);

int colCount = foo.getCollisionCount();

System.out.println("Number of collisions: " + colCount);

pw.println("Number of collisions: " + colCount);

System.out.println("My hash function uses a lexicographic approach to find a number for each word, the word is then mapped to an array location via a %37 operation.");

pw.println("My hash function uses a lexicographic approach to find a number for each word, the word is then mapped to an array location via a %37 operation.");

}

public boolean inHashTable(String arg, ObjectList hash [])

{

char [] charArray = arg.toCharArray();

ObjectList [] hashTable = hash;

int sum = 0;

for(int n = 0; n < charArray.length; n++)

{

sum += charArray[n];

}

int hashValue = sum % 37;

ObjectList tempList = hashTable[hashValue];

if(tempList == null)

{

return false;

}

ObjectListNode node = (ObjectListNode)tempList.getFirstNode();

while(node != null)

{

Word temp = (Word)node.getInfo();

String tempString = temp.getWord();

if(tempString.equals(arg))

{

return true;

}

else

{

node = node.getNext();

}

}

return false;

}

}

-------------------------------------------------------------------

LinePosition.java

------------------------------------

public class LinePosition

{

private int lineCount;

private int linePosition;

public LinePo

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote