Upload
ram-ji
View
147
Download
6
Tags:
Embed Size (px)
Citation preview
Ex.No: COMPONENT SIMULATING CURRENCY CONVERSIONDate:
Aim: To write a program in C# to perform conversion of dollars to rupees.
Algorithm:
ALGORITHM FOR COMPONENT. Step 1: Create a namespace as CompCS. Step 2: Create a class called Conv as public. Step 3: Inside the class declare the private variables i,j of type integer. Step 4: Define a property variables x. Step 5: In the property we have the get and set method. Step 6: Get method is used to get the value form the user and set is used for setting the user value to the original variables. Step 7: Define a method called doll () as public. Step 7.1: Return the value of x * 45. Step 7.2: End of the method. Step 8: End of the component.
AGORITHM FOR MAIN.
Step 1: Create a class called ConvertComp Step 2: Define the main function. Step 2.1: Create an object ob for currency. Step 2.2 : Get the value of x using Console.Readline() method. Step 2.3: Print the converted value using Console.Writeline() method. Step 2.4: End of the main.
Program:
COMPONENT
using System;namespace CompCS{ public class Conv{ private int i=0,j=45; public int varI { get{return i;} set{i=value;} } public int sum() { return i*j; } }}
MAIN
using System;using CompCS;
class ConvertComp{ public static void Main() { Conv obj = new Conv(); Console.WriteLine("Enter the dollar amount u want to convert:"); int x = int.Parse(Console.ReadLine()); obj.varI = x; Console.WriteLine("Dollar value : {0}",obj.varI); Console.WriteLine("Ruppes value : {0}",obj.sum()); }}
Execution Steps:
1.Create a dll file for the component csc /target:library Convert.cs
2.Create an exe file for the main csc /reference:Convert.dll ConvertComp.cs
3.Run the exe file ConvertComp
Output:
Enter the dollar amount u want to convert:30Dollar value : 30Ruppes value : 1350
Ex.No: COMPONENT SIMULATING ENCRYPRION AND DECRYPTIONDate :
Aim: To write a C# program to perform encryption and decryption of the given data.
Algorithm
ALGORITHM FOR ENCRYPTION:
Step 1: Declare the class as encrypt class.Step 2: Start the main function.Step 3: Declare the variable str in string data type.Step 4: Create the object for inbuilt encryption algorithm TripleDESCryptoServiceProvider.Step 5: Create the data file using File stream class.Step 6: Create the object for class cryptoStream.Cryptostream is a class to invoke the Encryotor algorithm. Get the input from the user using Console.Readline ().Step 7: Write the input data using Write Line function.Step 8: Create the key file using File. Create.Step 9: convert the key file into binary form.Step 10: Close the file.Step 11: Print Data encrypted using console.writeLine.
ALGORITHM FOR DECRYPTION:
Step 1: Declare a class as decrypt class Step 2: start the main function Step 3: Create the object for the inbuild algorithm TripleDESCrypotserviceProvider. Step 4: Create the file in c drive using FileStream fs =File.openRead. Step 5: Using Binary Reader convert file as in binary form. Step 6: Read the number of bytes of key file. Step 7: Open the data file using File Read function. Step 8: Crypto stream is a class to use invoke the Decrytptor. Step 9: Create the object for CryptoStream class. Step 10: Using Stream Reader read the data file. Step 11: Print the content of data file using Console.writeLine. Step 12: Close the file.
Program:
Encryption
using System;using System.IO;using System.Security.Cryptography;
class encrypt_class{public static void Main(){String str;
TripleDESCryptoServiceProvider cp= new TripleDESCryptoServiceProvider();
FileStream fs = File.Create("s:\\file.dat");CryptoStream cs = newCryptoStream(fs,cp.CreateEncryptor(),CryptoStreamMode.Write);StreamWriter sw = new StreamWriter(cs);
Console.WriteLine("Enter a string");str=Console.ReadLine();
sw.WriteLine(str);sw.Close();
fs= File.Create("s:\\file.key");BinaryWriter bw = new BinaryWriter(fs);bw.Write(cp.Key);bw.Write(cp.IV);bw.Close();
Console.WriteLine("Data Encrypted........");}}
Decryption:
using System;using System.IO;using System.Security.Cryptography;
class decrypt_class{
public static void Main(){
TripleDESCryptoServiceProvider cp= new TripleDESCryptoServiceProvider();
FileStream fs = File.OpenRead("s:\\file.key");BinaryReader br = new BinaryReader(fs);cp.Key=br.ReadBytes(24);cp.IV=br.ReadBytes(8);
fs= File.OpenRead("s:\\file.dat");CryptoStream cs = newCryptoStream(fs,cp.CreateDecryptor(),CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cs);
Console.WriteLine("Content in the file (After Decryption)");
Console.WriteLine(sr.ReadLine());Console.ReadLine();sr.Close();}}
Execution: csc encrypt_class.cs encrypt_class file
Enter the string Abcdefghijklmnopqrstuvwxyz Data encrypted…… csc decrypt_class.cs
decrypt_class file Content in the file is (After decryption) Abcdefghijklmnopqrstuvwxyz.
Ex No: APPLICATION FOR ACCESSING THE SERVICES FROM Date : SERVER USING RMI
AIM: To write a Program to find the Square and Power of a given number using RMI.
ALGORITHM:
Step 1: Start the process.Step 2: Declare the interface called interf extends Remote Interface.Step 3: Declare the two functions,public int square(int a)throws RemoteException;
public int power(int x,int y)throws RemoteException;Step 4: Define class remoteclass that extends UnicastRemoteObject Class and implements interf.Step 5:Define methods power() and square() and return the required outputStep 6: Define a class serverclass and Declare a object for the remoteclass in the Server.Step 7: Using naming.rebind register the object in to the rmiregistry.Step 8: Define a class clientclass and a String URL=”rmi://172.16.1.104/svce”;Step 9: Define interf a=(interf) Naming.lookup(URL);Step 10: Get the value from the user and Calculate the power and square from the functions.Step 11: Display the result.Step 12: Stop the process.
PROGRAM:
REMOTE INTERFACE :import java.rmi.*;
public interface interf extends Remote{ public int square(int a)throws RemoteException; public int power(int x,int y)throws RemoteException;
}
REMOTE CLASS :
import java.io.*;import java.rmi.*;import java.net.*;import java.rmi.server.*;public class remoteclass extends UnicastRemoteObject implements interf{ public remoteclass() throws RemoteException { }public int square(int a)throws RemoteException{ return(a*a); }public int power(int x,int y)throws RemoteException{ int z,i; z=1;i=0; for(i=y;i>0;i--) { z=z*x; } return(z); }}
SERVER CLASS:
import java.io.*;import java.net.*;import java.rmi.*;public class serverclass { public static void main(String arg[]) {
try {
remoteclass rc=new remoteclass(); Naming.rebind("svce",rc);}
catch(Exception e) { }
}}
CLIENT CLASS:
import java.rmi.*;public class clientclass { public static void main(String arg[]) { try {
int b1,b; String str="rmi://localhost/svce"; interf a=(interf)Naming.lookup(str); b=Integer.parseInt(arg[0]); b1=Integer.parseInt(arg[1]); System.out.print("a : "+b+" b : "+b1); int s= a.square(b); System.out.print(" SQUARE VALUE : "+s); int c=a.power(b,b1); System.out.println(" POWER : "+c);
} catch(Exception e)
{ } } }
OUTPUT : Z:\mware\rmiapp>java clientclass 2 4 a : 2 b : 4
To create an session Bean for performing Bank operations.
Procedure
Step 1: Create the remote interface extends EJB object.Step 2: Create the home interface that extends EJB home.Step 3: Write a server program that implements the business method in remote interface class. Step 4: Write a client program for the and lookup for the object.Step 5: Set Path,class path and set the environment. Step 6: Compile the interface,implementation class,server and the client.Step 7: Start the serverStep 8: Create the meta-inf and the jar file.Step 9: Load the jar fileStep 10. Run the client
PROGRAM
// Remote interface for test EJB’s
import javax.ejb.EJBObject;
import java.rmi.RemoteException;puplic interface MkRemote extends EJBObject{ public int check(int amount,int bal,char c) throws RemoteException; }
// Home interface
import java.io.Serializable;import java.rmi.RemoteException;import javax.ejb.CreateException;import javax.ejb.EJBHome;import javax.ejb.*;
public interface MkHome extends EJBHome{ public MkRemote create() throws RemoteException,CreateException;}
// Server program
import java.rmi.RemoteException;import javax.ejb.SessionBean;import javax.ejb.SessionContext;public classs MkEJB implements SessionBean{ private SessionContext m_context; public int check(int amount,int bal,char c) throws RemoteException { if(c==’w’) bal=bal-amount; else bal=bal+amount; return bal; } public MkEJB() { } public void ejbCreate() { System.out.println(“MkEJB created”);
}
public void ejbRemove(){ System.out.println(“MkEJB removed”);} public void ejbActivate(){System.out.println(“MkEJB activated”);} public void ejbPassivate(){System.out.println(“MkEJB passivated”);} public void setSessionContext(SessionContext sc) { m_context=sc; System.out.println(“session context assigned”); }
// Client
import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.naming.*; import java.util.*; import MkHome; import MkRemote;
public class MkClient { public static void main(String[] args) { System.out.println(“Connected!”); try { Context initial=new InitialContext(); Object objref=initial.lookup(“Bank”); if(objref==null) { System.out.println(“could not create object”); } MkHome home=(MkHome)PortableRemoteObject.narrow(objref,MkHome.class); MkRemote.bean=home.create(); Int nb=bean.check(500,5000,’w’); System.out.println(“Banking Operation”); System.out.println(“Balance Amount”+nb); bean.remove();
} catch(Exception ex) { System.err.println(“Caught an unexpected exception!”); ex.printStackTrace(); } } }
Step 1:
Z:\EJB>setpathZ:\EJB>set JAVA_HOME=c:\jdk1.3Z:\EJB>set J2EE_HOME=c:\j2sdkee1.2.1Z:\EJB>set CPATH=.;c:\j2sdkee1.2.1\lib\j2ee.jarZ:\EJB>set path=c:\jdk1.3\bin;c:\j2sdkee1.2.1\bin;Z:\EJB>set CPATH=.;c:\j2sdkee1.2.1\lib\tools.jar;c:\j2sdkee1.2.1\lib\j2ee.jar;c:\jdk1.3\jre\lib\rt.jar;Z:\EJB>javac -classpath %CPATH% Temperature.java TemperatureHome.java TemperatureEJB.javaZ:\EJB>j2ee -verbose
Step 2:Z:\EJB>setpathZ:\EJB>set JAVA_HOME=c:\jdk1.3Z:\EJB>set J2EE_HOME=c:\j2sdkee1.2.1Z:\EJB>set CPATH=.;c:\j2sdkee1.2.1\lib\j2ee.jarZ:\EJB>set path=c:\jdk1.3\bin;c:\j2sdkee1.2.1\bin;Z:\EJB>set CPATH=.;c:\j2sdkee1.2.1\lib\tools.jar;c:\j2sdkee1.2.1\lib\j2ee.jar;c:\jdk1.3\jre\lib\rt.jar;Z:\EJB>deploytoolZ:\EJB>javac -classpath %CPATH% TemperatureClient.javaZ:\EJB>set CPATH=.;C:\j2sdkee1.2.1\lib\j2ee.jar;z:\EJB\TemperatureClient.jarZ:\EJB>java -classpath %CPATH% TemperatureClient
EX. N0. File Operations using Active-X controlDate :
Aim : To write a c# program that performs the file operation using ActiveX Controls.
Algorithm :
Step 1 Open the c# application and choose the windows application editor. Step 2 Place text boxes, labels,button,directory box, drive box,file list box. Step 3 Open every component and write the corresponding code for all the controls.
Step 4 Create and delete the files using this program. Step 6 Use Active-x controls for created controls.
Step 7. Stop
PROGRAM:
using System;using System.Drawing;using System.Collections;
using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.IO;
namespace WindowsApplication1{ /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.IO.StreamReader sr; private System.IO.StreamWriter sw; private System.Windows.Forms.Splitter splitter1; private System.Windows.Forms.Label label1; private Microsoft.VisualBasic.Compatibility.VB6.DriveListBox driveListBox1; private Microsoft.VisualBasic.Compatibility.VB6.DirListBox dirListBox1; private Microsoft.VisualBasic.Compatibility.VB6.FileListBox fileListBox1; private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label2; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;
public Form1() { // // Required for Windows Form Designer support // InitializeComponent();
// // TODO: Add any constructor code after InitializeComponent call // }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.driveListBox1 = new Microsoft.VisualBasic.Compatibility.VB6.DriveListBox(); this.dirListBox1 = new Microsoft.VisualBasic.Compatibility.VB6.DirListBox(); this.fileListBox1 = new Microsoft.VisualBasic.Compatibility.VB6.FileListBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(56, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(64, 16); this.label1.TabIndex = 0;
this.label1.Text = "File name"; // // driveListBox1 // this.driveListBox1.Location = new System.Drawing.Point(32, 88); this.driveListBox1.Name = "driveListBox1"; this.driveListBox1.Size = new System.Drawing.Size(128, 21); this.driveListBox1.TabIndex = 1; this.driveListBox1.SelectedIndexChanged += new System.EventHandler(this.driveListBox1_SelectedIndexChanged); // // dirListBox1 // this.dirListBox1.IntegralHeight = false; this.dirListBox1.Location = new System.Drawing.Point(136, 136); this.dirListBox1.Name = "dirListBox1"; this.dirListBox1.Size = new System.Drawing.Size(152, 48); this.dirListBox1.TabIndex = 2; this.dirListBox1.SelectedIndexChanged += new System.EventHandler(this.dirListBox1_SelectedIndexChanged); // // fileListBox1 // this.fileListBox1.Location = new System.Drawing.Point(192, 216); this.fileListBox1.Name = "fileListBox1"; this.fileListBox1.Pattern = "*.*"; this.fileListBox1.Size = new System.Drawing.Size(160, 56); this.fileListBox1.TabIndex = 3; this.fileListBox1.SelectedIndexChanged += new System.EventHandler(this.fileListBox1_SelectedIndexChanged); // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(368, 104); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(184, 120); this.richTextBox1.TabIndex = 4; this.richTextBox1.Text = ""; // // textBox1 //
this.textBox1.Location = new System.Drawing.Point(136, 32); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(128, 20); this.textBox1.TabIndex = 5; this.textBox1.Text = ""; this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // textBox2 // this.textBox2.Location = new System.Drawing.Point(560, 32); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(144, 20); this.textBox2.TabIndex = 6; this.textBox2.Text = ""; this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // // button1 // this.button1.Location = new System.Drawing.Point(600, 112); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(72, 40); this.button1.TabIndex = 7; this.button1.Text = "CREATE"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(600, 184); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(72, 40); this.button2.TabIndex = 8; this.button2.Text = "DELETE"; this.button2.Click += new System.EventHandler(this.button2_Click); // // label2 // this.label2.Location = new System.Drawing.Point(488, 32); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(56, 24); this.label2.TabIndex = 9; this.label2.Text = "File path";
// // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(728, 310); this.Controls.Add(this.label2); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.richTextBox1); this.Controls.Add(this.fileListBox1); this.Controls.Add(this.dirListBox1); this.Controls.Add(this.driveListBox1); this.Controls.Add(this.label1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false);
} #endregion
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }
private void Form1_Load(object sender, System.EventArgs e) { }
private void button1_Click(object sender, System.EventArgs e) { sw=File.CreateText(textBox1.Text); sw.WriteLine("Welcome");
sw.Close();
}
private void button2_Click(object sender, System.EventArgs e) { try { DialogResult dr; dr=MessageBox.Show("R U sure to Delete a file"+fileListBox1.FileName+"?","confirmation",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if(dr==DialogResult.No) return; sr.Close(); File.Delete(fileListBox1.Path+"//"+fileListBox1.FileName); fileListBox1.Refresh(); dirListBox1.Refresh(); driveListBox1.Refresh(); richTextBox1.Clear(); richTextBox1.Text+="Deleted succeeded"; } catch(Exception ex) { MessageBox.Show("Error"+ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error); }
}
private void dirListBox1_SelectedIndexChanged(object sender,System.EventArgs e) { fileListBox1.Path=dirListBox1.Path; }
private void driveListBox1_SelectedIndexChanged(object sender,System.EventArgs e) { dirListBox1.Path=driveListBox1.Drive; }
private void fileListBox1_SelectedIndexChanged(object sender,System.EventArgs e) {
String filepath=fileListBox1.Path+"//"+fileListBox1.FileName; sr=new StreamReader(filepath); richTextBox1.Text=sr.ReadToEnd(); textBox2.Text=filepath; }
private void textBox1_TextChanged(object sender, System.EventArgs e) { }
private void textBox2_TextChanged(object sender, System.EventArgs e) { }
}}
Output :
Ex.No. Drawing Graphical Shapes Without Using BDK Date
AIM:
To write a program to draw some graphical shapes without using BDK.
ALGORITHM:
Step 1: Start the program.
Step 2: Create a class which extends Frame and include the Mouse Listener interface.
Step 3: In that interface, a function which calls the change() and changeshape() function.
Step 4: Using the function, close the window whenever not need.
Chang():
Step 1: Assign the value of randomcolor() t a variable color.
Step 2: Call the repaint() function.
Changeshape():
Step 1: Check if the shape is rectangular, then assign ‘false’ value to that shape.
Step 2: Else assign ‘true’ value.
Step 3: Again call the paint() function.
Randomcolor:
Step 1: Using the rgb color with the total number of color, multiply with the math.random().
Step 2: Return the colors.
Paint():
Step 1: Assign the height and width for drawing a shape.
Step 2: If it is rectangular, using fillRect() draw it.
Step 3: Else draw oval.
PROGRAM:
import java.awt.*;import java.awt.event.*;public class c extends Frame{ private Color color; private boolean rectangular; public c() { addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { change(); changeShape(); } }); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); rectangular=true; }
public void change(){ color=randomColor(); repaint();}public void changeShape(){ if(rectangular) rectangular=false; else rectangular=true; repaint();}public Color randomColor() { int r=(int)(255*Math.random()); int g=(int)(255*Math.random());
int b=(int)(255*Math.random()); return new Color(r,g,b); } public void paint(Graphics g) { Dimension d=getSize(); int w=d.width-300; int h=d.height-200; g.setColor(color); if(rectangular) g.fillRect(100,100,w-1,h-1); else g.fillOval(100,100,w-1,h-1); } public static void main(String k[]) { c ob=new c(); ob.setSize(1024,768); ob.setVisible(true);}}
OUTPUT:
Oval Shape
Ex No: EJB – LIBRARY OPERATIONS
Date:
Aim: To create Session Bean for performing Library operations.
Procedure
Step 1: Create the remote interface extends EJB object.Step 2: Create the home interface that extends EJB home.Step 3: Write a server program that implements the business method in remote interface class. Step 4: Write a client program for the and lookup for the object.Step 5: Set Path,class path and set the environment. Step 6: Compile the interface,implementation class,server and the client.Step 7: Start the serverStep 8: Create the meta-inf and the jar file.Step 9: Load the jar fileStep 10. Run the client
//Remote interface for test EJB’s
import javax.ejb.EJBObject;import java.rmi.RemoteException;public interface MKRemote extends EJBObject{ public int check(int nb,char c)throws RemoteException;}
//Home interface
import java.io.Serializable;import java.rmi.RemoteException;import javax.ejb.CreateException;import javax.ejb.EJBHome;import javax.ejb.*;
public interface MkHome extends EJBHome{ public MkRemote create() throws RemoteException, CreateException;
}//Session bean for test EJB’S
import java.rmi.RemoteException;import.javax.ejb.SessionBean;import.javax.ejb.SessionContext;
public class MkEJB implements SessionBean{ private SessionContext m_context; public int check(int nb,char c)throws RemoteException { if(c==’w’) nb=nb-1; else nb=nb+1; return nb; }
public MkEJB() {} public void ejbCreate() {
System.out.println(“MkEJB created”);}
public void ejbRemove(){ System.out.println(“MkEJB removed”);}
public void ejbActivate(){ System.out.println(“MkEJB activated”);}public void ejbPassivate(){ System.out.println(“MkEJB passivated”);}public void setSessionContext(SessionContext sc){ m_context=sc; System.out.println(“session context assigned”);}
//Clientimport javax.naming.Context;import javax.naming.InitialContext;import javax.rmi.PortableRemoteObject;import javax.naming.*;import java.util.*;import MkHome;import MkRemote;
public class MkClient{ public static void mian(String[] args) { System.out.println(“Connected!”);
try { Context initial = new InitialContext(); Object objref = initial.lookup(“library”); if(objref==null) { System.out.println(“Couldnot crate object”); } MkHome home = (MkHome)PortableRemoteObject.narrow(objref,MkHome.class);
MkRemote bean = home.create(); int nb = bean.check(10,’w’); System.out.println(“Library Information System”); System.out.println(“Number of Books” + nb); Bean.remove(); } catch(Exception ex) { System.err.println(“Caught an unexpected exception!”);
Ex.printStackTrace();
} }}
EX. NO. RETRIEVING INFORMATION FROM MESSAGE BOXDate :
Aim : To write a c# program that performs the information retrieval from message box.
Algorithm : Step 1 Open the c# application and choose the windows application editor. Step 2 place text box, labels, and buttons, Step 3 open every component and write the corresponding code all the controls.
Step 4 Debug the application. Step 5 Retrieve the information from various buttons in the form.
Step 6 Close the project.
Program :
using System;
using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;
namespace WindowsApplication7{ /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button7; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;
public Form1() { // // Required for Windows Form Designer support // InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call // }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.textBox4 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button();
this.SuspendLayout(); // // label1 // this.label1.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label1.Location = new System.Drawing.Point(48, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(184, 32); this.label1.TabIndex = 0; this.label1.Text = "Enter the String 1"; // // label2 // this.label2.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label2.Location = new System.Drawing.Point(48, 80); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(176, 32); this.label2.TabIndex = 1; this.label2.Text = "Enter the String 2"; // // label3 // this.label3.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label3.Location = new System.Drawing.Point(64, 152); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(128, 24); this.label3.TabIndex = 2; this.label3.Text = "Result"; // // label4 // this.label4.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label4.Location = new System.Drawing.Point(40, 232); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(240, 48); this.label4.TabIndex = 3; this.label4.Text = "Enter the starting position of the string";
// // textBox1 // this.textBox1.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.textBox1.Location = new System.Drawing.Point(336, 24); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(176, 32); this.textBox1.TabIndex = 4; this.textBox1.Text = ""; // // textBox2 // this.textBox2.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.textBox2.Location = new System.Drawing.Point(336, 80); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(176, 32); this.textBox2.TabIndex = 5; this.textBox2.Text = ""; // // textBox3 // this.textBox3.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.textBox3.Location = new System.Drawing.Point(336, 152); this.textBox3.Name = "textBox3"; this.textBox3.Size = new System.Drawing.Size(176, 32); this.textBox3.TabIndex = 6; this.textBox3.Text = ""; // // textBox4 // this.textBox4.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.textBox4.Location = new System.Drawing.Point(336, 248); this.textBox4.Name = "textBox4"; this.textBox4.Size = new System.Drawing.Size(184, 32); this.textBox4.TabIndex = 7; this.textBox4.Text = ""; //
// button1 // this.button1.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button1.Location = new System.Drawing.Point(64, 408); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(152, 40); this.button1.TabIndex = 8; this.button1.Text = "Concatenation"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button2.Location = new System.Drawing.Point(536, 408); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(120, 40); this.button2.TabIndex = 9; this.button2.Text = "Substring"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button3.Location = new System.Drawing.Point(304, 408); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(112, 40); this.button3.TabIndex = 10; this.button3.Text = "Message"; this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // this.button4.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button4.Location = new System.Drawing.Point(288, 520); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(128, 40); this.button4.TabIndex = 11;
this.button4.Text = "Lower case"; this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // this.button5.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button5.Location = new System.Drawing.Point(72, 520); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(120, 40); this.button5.TabIndex = 12; this.button5.Text = "Upper case"; this.button5.Click += new System.EventHandler(this.button5_Click); // // button6 // this.button6.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button6.Location = new System.Drawing.Point(552, 512); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(88, 40); this.button6.TabIndex = 13; this.button6.Text = "Length"; this.button6.Click += new System.EventHandler(this.button6_Click); // // button7 // this.button7.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.button7.Location = new System.Drawing.Point(264, 624); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(232, 40); this.button7.TabIndex = 14; this.button7.Text = "Clear"; this.button7.Click += new System.EventHandler(this.button7_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(896, 678); this.Controls.Add(this.button7);
this.Controls.Add(this.button6); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.textBox4); this.Controls.Add(this.textBox3); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false);
} #endregion
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }
private void Form1_Load(object sender, System.EventArgs e) { }
private void button1_Click(object sender, System.EventArgs e) { textBox3.Text=textBox1.Text+textBox2.Text; }
private void button3_Click(object sender, System.EventArgs e) { int i=textBox3.Text.Length; int j=int.Parse(textBox4.Text); string s=textBox3.Text.Substring (j-1,(i-j)+1); MessageBox.Show(""+s,"Substring"); }
private void button2_Click(object sender, System.EventArgs e) { MessageBox.Show(""+textBox3.Text,"concatenation"); }
private void button6_Click(object sender, System.EventArgs e) { MessageBox.Show(""+textBox3.Text.Length,"Length of the string"); }
private void button5_Click(object sender, System.EventArgs e) { string s=textBox3.Text; textBox3.Text = s.ToLower(); MessageBox.Show(s.ToLower(),"Lower Case"); }
private void button4_Click(object sender, System.EventArgs e) { string s=textBox3.Text; textBox3.Text = s.ToUpper(); MessageBox.Show(s.ToUpper(),"Upper case"); }
private void button7_Click(object sender, System.EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; } }}
Ex no : FILE TRANSFER USING RMIDate :
AIM:
To write a java program to perform a File Transfer in a simulated environment using RMI.
Algorithm:
Step-1 : Define an interface ‘RMIInterface’ that extends the remote interface.
Step-2 : To declare the ‘ReadFile’ method within the interface which throws RemoteException.
Step-3 : Define a class ‘RMIServerImpl’ that implements the interface. Because the new interface extends Remote, this fulfills the requirements for making the new class remote object.
Step-4 : The class must provide a means to Marshall References to the instances of the class.
Step-5 : Generate the stubs and skeletons that are needed for the remote implementations by using the rmic command.
Step-6 : Create a client program ‘RMIClient’ that will make RMI calls to the server.
Step-7 : Start the registry and run the remote server and client.
Step-8 : To pass requested file name as a parameter that are required by an RMI method, the objects are passed using their references.
Step-9 : The server responses with result to the client.
//File transfer using Remote Method Invocation(RMI)
//Client
import java.rmi.*;import java.io.*;import java.net.*;public class RMIClient{public static void main(String a[]) throws RemoteException{try{RMIInterface obj=(RMIInterface)Naming.lookup("rmi://127.0.0.1/RMIServerImpl");String msg=obj.ReadFile(a[0]);System.out.println(msg);}catch(Exception e){System.out.println(e);}}}
//Implementation
import java.rmi.*;import java.io.*;import java.net.*;import java.rmi.server.*;public class RMIServerImpl extends UnicastRemoteObject implements RMIInterface{public RMIServerImpl() throws RemoteException{}public String ReadFile(String fname) throws java.rmi.RemoteException{String str=null;
try{FileReader fr=new FileReader(fname);char data[]=new char[1024];
int charsread=fr.read(data);str=new String(data,0,charsread);fr.close();}catch(Exception e){System.out.println(e);}return str;}}
//Interface
import java.rmi.*;import java.io.*;import java.rmi.server.*;public interface RMIInterface extends Remote{public String ReadFile(String fname) throws java.rmi.RemoteException;}
//Server
import java.rmi.*;import java.io.*;import java.rmi.server.*;public class RMIServer{public static void main(String a[]){try{RMIServerImpl obj=new RMIServerImpl();Naming.rebind("/RMIServerImpl",obj);}
catch(Exception e){System.out.println(e);
}}}
Output:
Server Side:
C:\>F:F:\>cd Java\pgm2F:\Java\pgm2>set path=c:\jdk1.5.0\binF:\Java\pgm2>javac RMI*.javaF:\Java\pgm2>rmic RMIServerImplF:\Java\pgm2>start rmiregistry F:\Java\pgm2>java RMIServer
Client Side:
C:\>F:F:\>cd Java\pgm2F:\Java\pgm2>set path=c:\jdk1.5.0\binF:\Java\pgm2>java RMIClient RMIInterface.javaimport java.rmi.*;import java.io.*;import java.rmi.server.*;public interface RMIInterface extends Remote{public String ReadFile(String fname) throws java.rmi.RemoteException;}
Result:
Thus the program is executed and the results are verified.
Ex. No. Middleware component for retrieving Stock Market Exchange information using CORBA
Aim:
Develop a middleware component for retrieving Stock Market Exchange information using CORBA
Algorithm:
Step 1: Write IDL that describes the interfaces to the object.Step 2: Compile the IDL file.Step 3: Identify the IDL Compiler generated interfaces and classes to implement the operations.Step 4: Write code to initialize the ORB.Step 5: Compile all generated codes.Step 6: Run the server by using the command “start orbd -ORBInitialPort 1050 -ORBInitialHost localhost”Step 7: Run the client by using the command
Program:
Interface
Interface // To save : StockMarket.idl //
module SimpleStocks{interface StockMarket{ float get_price(in string symbol);};};
Implementation
//To Save : StockMarketImpl.java//
import org.omg.CORBA.*;import SimpleStocks.*;
public class StockMarketImpl extends _StockMarketImplBase{ public float get_price(String symbol){ float price=0;for(int i=0;i<symbol.length();i++){ price+=(int)symbol.charAt(i);}price/=5;return price;}public StockMarketImpl(){super();}}
Server
//To save StockMarketServer.java//
import org.omg.CORBA.*;import org.omg.CosNaming.*;import SimpleStocks.*;
public class StockMarketServer{
public static void main(String[] args) { try { ORB orb=ORB.init(args,null); StockMarketImpl stockMarketImpl=new StockMarketImpl();orb.connect(stockMarketImpl);org.omg.CORBA.Object objRef=orb.resolve_initial_references("NameService"); NamingContext ncRef=NamingContextHelper.narrow(objRef); NameComponent nc=new NameComponent("NASDAQ",""); NameComponent path[]={nc}; ncRef.rebind(path,stockMarketImpl); System.out.println("StockMarket server is ready");Thread.currentThread().join(); }catch(Exception e){e.printStackTrace();}}}
Client
//To save StockMarketClient.java//
import org.omg.CORBA.*;import org.omg.CosNaming.*;import SimpleStocks.*;
public class StockMarketClient{
public static void main(String[] args) { try { ORB orb=ORB.init(args,null); NamingContext ncRef=NamingContextHelper.narrow(orb.resolve_initial_references("NameService")); NameComponent path[]={new NameComponent("NASDAQ","")}; StockMarket market=StockMarketHelper.narrow(ncRef.resolve(path));System.out.println("Price of My company is"+market.get_price("My_COMPANY"));}catch(Exception e){e.printStackTrace();}}}
// StockMarket program Running Procedure
StockMarket Exchange details
C:\stock>set path=”g:\j2sdk1.4.2\bin”;
C:\stock>idlj StockMarket.idl
C:\stock>idlj -fall -oldImplBase StockMarket.idl
C:\stock>javac StockMarketImpl.java
C:\stock>javac StockMarketServer.java
C:\stock>javac StockMarketClient.java
C:\stock>start tnameserv -ORBInitialPort 1050
Initial Naming Context:IOR:000000000000002b49444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000000000001000000000000007c000102000000000a3132372e302e302e3100041a00000035afabcb0000000020226fdf840000000100000000000000010000000d544e616d65536572766963650000000000000004000000000a0000000000000100000001000000200000000000010001000000020501000100010020000101090000000100010100TransientNameServer: setting port for initial object references to: 1050Ready.
C:\stock>start java StockMarketServer -ORBInitialPort 1050
Initial Naming Context:IOR:000000000000002b49444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000000000001000000000000007c000102000000000a3132372e302e302e3100041a00000035afabcb0000000020226fdf840000000100000000000000010000000d544e616d65536572766963650000000000000004000000000a0000000000000100000001000000200000000000010001000000020501000100010020000101090000000100010100TransientNameServer: setting port for initial object references to: 1050Ready.
C:\stock>java StockMarketClient -ORBInitialPort 1050Price of My company is165.6
Result:
Thus the program is executed and the results are verified.
Ex.No: COMPONENT SIMULATING STRING OPERATIONSDate:
Aim: To write a program in C# for string manipulations.
Algorithm:
Step 1: Create a namespace as StringProgram. Step 2: Create a class called strcal as public. Step 3: Inside the class declare the private variables s of type string. Step 4: Define a property variables s. Step 5: Define a method called fun() as public. Step 5.1: String s1,a,b,c; s1=s.Substring(0,1); a=s1.ToUpper(); b=s.Substring(1,s.Length-1); c=a+b.ToLower(); return(c); Step 5.2: End of the method. Step 6: End of the main.
Program:
using System;
namespace StringProgram{ class strcal { public static void Main() {
String str,str1; Console.WriteLine("Enter a String"); str = Console.ReadLine(); Console.WriteLine(str.ToUpper()); Console.WriteLine(str.ToLower()); Console.WriteLine(str.Substring(0,3)); Console.WriteLine("Enter another String"); str1 = Console.ReadLine(); int n = str.CompareTo(str1); if(n==0) Console.WriteLine("Strings are equal"); else Console.WriteLine("Strings are not equal"); Console.ReadLine(); } }}
Execution Steps:
1.Create an exe file for the main
csc strcal.cs
2.Run the exe file strcal
Output:
Enter a String : abcdef
Uppercase : ABCDEFLowercase : abcdefSubstring : abcEnter another String : ABCdefStrings are not equal
Result:
Thus the program is executed and the results are verified.
EX. NO. CURRENCY CONVERTOR- WINDOWS APPLICATIONDate :
Aim : To write a c# program that performs the currency conversion.
Algorithm: Step 1 Open the c# application and choose the windows application editor. Step 2 place text boxes, labels, and buttons, Step 3 open every component and write the corresponding code all the controls.
Step 4 Debug the application. Step 5 Convert the rupees from various buttons in the form.
Step 6 Close the project.
Program :
using System;using System.Drawing;
using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;
namespace curconv{ /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;
public Form1() { // // Required for Windows Form Designer support // InitializeComponent();
// // TODO: Add any constructor code after InitializeComponent call // }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) {
if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = 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.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(32, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(160, 40); this.label1.TabIndex = 0; this.label1.Text = "Foreign Currency Value:"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(240, 24); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(216, 20); this.textBox1.TabIndex = 1; this.textBox1.Text = "";
// // button1 // this.button1.Location = new System.Drawing.Point(144, 216); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(144, 40); this.button1.TabIndex = 2; this.button1.Text = "US DOLLAR"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(400, 216); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(136, 40); this.button2.TabIndex = 3; this.button2.Text = "BRITISH POUND"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Location = new System.Drawing.Point(624, 216); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(128, 40); this.button3.TabIndex = 4; this.button3.Text = "RUSSIAN RUBLE"; this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // this.button4.Location = new System.Drawing.Point(272, 312); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(152, 48); this.button4.TabIndex = 5; this.button4.Text = "SOUDI RIYAL"; this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // this.button5.Location = new System.Drawing.Point(536, 312); this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(152, 48); this.button5.TabIndex = 6; this.button5.Text = "KUWAIT DINAR"; this.button5.Click += new System.EventHandler(this.button5_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(1016, 502); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Controls.Add(this.label1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false);
} #endregion
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }
private void button1_Click(object sender, System.EventArgs e) { double u=double.Parse(textBox1.Text); double d=(49.50)*u; MessageBox.Show("Equivalent Indian Rs."+d); }
private void button2_Click(object sender, System.EventArgs e) {
double b=double.Parse(textBox1.Text); double p=(53.55)*b; MessageBox.Show("Equivalent Indian Rs."+p); }
private void button3_Click(object sender, System.EventArgs e) { double r=double.Parse(textBox1.Text); double c=(14.30)*r; MessageBox.Show("Equivalent Indian Rs."+c); }
private void button4_Click(object sender, System.EventArgs e) { double s=double.Parse(textBox1.Text); double y=(13.25)*s; MessageBox.Show("Equivalent Indian Rs."+y); }
private void button5_Click(object sender, System.EventArgs e) {
double k=double.Parse(textBox1.Text); double i=(165.30)*k; MessageBox.Show("Equivalent Indian Rs."+i); }}}