PBKK - Tugas 3

 

Currency Calculator Converter

1. buat projek baru

2. Tulislah Code Seperti dibawah ini

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();
                }
            }
        }
    }
}


3. Hasil



Komentar

Postingan populer dari blog ini

PBKK - Tugas 9

PBKK - Tugas 4

ETS - PBKK