Tugas 3 - Currency Converter Application

 Currency Converter Application


1. Static Currency Application
1.1 Siapkan project yang ingin dibuat
1.2 Buatlah design pada Form1.cs [Design] dengan tutorial seperti pada post sebelumnya sehingga membentuk seperti ini.


1.3 Tambahkan baris kode ini pada file Form1.cs
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;

namespace CurrencyConverter
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void convertButton_Click(object sender, EventArgs e)
        {
            if (usdRadioButton.Checked == true)
            {
                if (string.IsNullOrEmpty(inputBox.Text))
                {
                    inputBoxLabel.Text = "Insert number in IDR!";
                    inputBoxLabel.ForeColor = Color.Red;
                }
                else
                {
                    inputBoxLabel.Text = "IDR";
                    inputBoxLabel.ForeColor = Color.Black;

                    double output = double.Parse(inputBox.Text) * 0.000069;

                    resultBox.Text = output.ToString();
                }
            }

            else if (jpyRadioButton.Checked == true)
            {

                if (string.IsNullOrEmpty(inputBox.Text))
                {
                    inputBoxLabel.Text = "Insert number in IDR!";
                    inputBoxLabel.ForeColor = Color.Red;
                }
                else
                {
                    inputBoxLabel.Text = "IDR";
                    inputBoxLabel.ForeColor = Color.Black;

                    double output = double.Parse(inputBox.Text) * 0.000075;

                    resultBox.Text = output.ToString();
                  
                }
            }
            else if (eurRadioButton.Checked == true)
            {
                if (string.IsNullOrEmpty(inputBox.Text))
                {
                    inputBoxLabel.Text = "Insert number in IDR!";
                    inputBoxLabel.ForeColor = Color.Red;
                }
                else
                {
                    inputBoxLabel.Text = "IDR";
                    inputBoxLabel.ForeColor = Color.Black;

                    double output = double.Parse(inputBox.Text) * 0.000058;

                    resultBox.Text = output.ToString();
                }
            }
        }
    }
}

1.4 Dan hasilnya adalah sebagai berikut ini.



2. Dynamic Currency Application

2.1 Siapkan project yang ingin dibuat

2.2 Buatlah design pada Form1.cs [Design] dengan tutorial seperti pada post sebelumnya sehingga membentuk seperti ini.
2.3 Dapatkan API dari Free Currency Converter 
2.4 Menambahkan package tambahan di Visual Studio 2019 yang berguna untuk parsing JSON dengan langkah sebagai berikut.

2.5 Untuk source code bisa akses di link berikut.
2.6 Dan hasilnya adalah sebagai berikut ini.

 





Komentar

Postingan populer dari blog ini

Tugas 2 - Simple Application .NET

Evaluasi Tengah Semester - PBKK

Tugas 4 - Login Form Using Windows Presentation Foundation