Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. class CWährungsrechner
  2. {
  3. public readonly double euro_dollar_kurs; // readonly Variable
  4.  
  5. public CWährungsrechner(double eurodollarkurs)
  6. {
  7. euro_dollar_kurs = eurodollarkurs;
  8. }
  9. public double w_umrechnung_euro_dollar(double betrag)
  10. {
  11. return betrag / euro_dollar_kurs;
  12. }
  13. public double w_umrechnung_dollar_euro(double betrag)
  14. {
  15. return betrag * euro_dollar_kurs;
  16. }
  17. //klasse
  18.  
  19. //haupt
  20. using System;
  21. using System.Collections.Generic;
  22. using System.ComponentModel;
  23. using System.Data;
  24. using System.Drawing;
  25. using System.Linq;
  26. using System.Text;
  27. using System.Windows.Forms;
  28.  
  29. namespace Windows_Forms_Währungsrechner
  30. {
  31. public partial class Form1 : Form
  32. {
  33. public Form1()
  34. {
  35. InitializeComponent();
  36. textBox_kurs.Text = "1,35";
  37. textBox_betrag_euro.Text = "1,00";
  38. textBox_betrag_dollar.Text= "1,00";
  39.  
  40. }
  41.  
  42. private CWährungsrechner berechnen;
  43. private void button4_Click(object sender, EventArgs e)
  44. {
  45. Close();
  46. }
  47.  
  48.  
  49.  
  50. private void button3_Click(object sender, EventArgs e)
  51. {
  52. double euro_dollar_kurs = Convert.ToDouble(textBox_kurs.Text);
  53. berechnen = new CWährungsrechner(euro_dollar_kurs);
  54. }
  55.  
  56. private void Form1_Load(object sender, EventArgs e)
  57. {
  58.  
  59. }
  60.  
  61. private void button1_Click(object sender, EventArgs e)
  62. {
  63. double EURO;
  64. double DOLLAR;
  65.  
  66. EURO = Convert.ToDouble(textBox_betrag_euro.Text);
  67. DOLLAR = berechnen.w_umrechnung_euro_dollar(EURO);
  68. textBox_betrag_dollar.Text = Convert.ToString(DOLLAR);
  69. }
  70.  
  71. private void button2_Click(object sender, EventArgs e)
  72. {
  73. double EURO;
  74. double DOLLAR;
  75.  
  76. EURO = Convert.ToDouble(textBox_betrag_euro);
  77. DOLLAR = berechnen.w_umrechnung_dollar_euro(EURO);
  78. textBox_betrag_euro.Text = Convert.ToString(EURO);
  79. }
  80.  
  81.  
  82.  
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement