ASSIGNMENT 4
Q1. Write ASP & C# code to design & function a Simple EMI calculator as shown below.
Program C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Simple_Interest_calculator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
float interest, Amount;
float month;
private void button1_Click(object sender, EventArgs e)
{
month =Convert.ToSingle(textBox3.Text) /12;
if (textBox1.Text != "" & textBox2.Text != "" & textBox3.Text != "")
{
interest = Convert.ToSingle(textBox1.Text) *
Convert.ToSingle(textBox2.Text) * month;
Amount = interest + Convert.ToSingle(textBox1.Text);
MessageBox.Show(" simple interest =" + " " + interest + " " + "Amount
=" + Amount);
}
else
{
MessageBox.Show("Enter the value");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
}
Form Designer.cs
namespace Simple_Interest_calculator
{
partial class Form1
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(41, 46);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Principal";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(379, 166);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Input values";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(159, 122);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(200, 20);
this.textBox3.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(41, 125);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(30, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Duration";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(159, 84);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(200, 20);
this.textBox2.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(41, 87);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Rate of Interest";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(159, 43);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(200, 20);
this.textBox1.TabIndex = 1;
this.textBox1.TextChanged += new
System.EventHandler(this.textBox1_TextChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(107, 199);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(95, 31);
this.button1.TabIndex = 2;
this.button1.Text = "Compute";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(279, 199);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(92, 31);
this.button2.TabIndex = 3;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(402, 252);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "Simple Interest calculator";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}
Output Screen