Download File
Download File
Download File
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
a. Create a JavaBean which gives the excange value of INR(Indian<br />
Ruppes) into equivalent American Dollar Value.<br />
95<br />
import java.awt.event.*;<br />
public class CurrCon extends Canvas<br />
{<br />
private String rupees;<br />
private double ERate=0.071;<br />
private NumberFormat fmt=NumberFormat.getInstance();<br />
public CurrCon()<br />
{<br />
setSize(70,70);<br />
rupees="1.0";<br />
change();<br />
}<br />
public String getRupees()<br />
{<br />
return rupees;<br />
}<br />
public void setRupees(String rupees)<br />
{<br />
this.rupees=rupees;<br />
}<br />
public void change()<br />
{<br />
rupees=get_val();<br />
repaint();<br />
}<br />
public String get_val()<br />
{<br />
double Value=Double.parseDouble(rupees);<br />
Value*=ERate;<br />
fmt.setMaximumFractionDigits(3);<br />
fmt.setMinimumFractionDigits(3);<br />
rupees="$"+fmt.format(Value);<br />
return rupees;<br />
}<br />
public void paint(Graphics g)<br />
{<br />
g.drawString(rupees,10,10);<br />
}<br />
};<br />
Procedute:<br />
1. Compile the above program and copy the class file in a folder.<br />
HYDERABAD INISTITUTE OF TECHOLOGY AND MANAGEMENT