public class Conversion
{
void dollartorupee()
{
int doller=Integer.parseInt(System.console().readLine("how many doolor u have"));
int rupees=doller*55;
System.out.println("rupees ="+rupees);
}
void rupeetodollar()
{
int rupees=Integer.parseInt(System.console().readLine("how many rupees u have"));
double doller=rupees*(1/55f);
System.out.println("doller ="+doller);
}
void metertokilometer()
{
int meter=Integer.parseInt(System.console().readLine("meter="));
double kilometer=meter*(1/1000f);
System.out.println("kilomiter ="+kilometer);
}
void kilometertometer()
{
int kilometer=Integer.parseInt(System.console().readLine("kilometer="));
int meter=kilometer*1000;
System.out.println("meter ="+meter);
}
void celsiustofarenhenite()
{
int celsius=Integer.parseInt(System.console().readLine("celsius="));
double farenhenite=celsius*(9/5f)+32;
System.out.println("farenhenite="+farenhenite);
}
void farenhenitetoccelsius()
{
int farenhenite=Integer.parseInt(System.console().readLine("farenhenite="));
double celsius=(farenhenite-32)*(5/9f);
System.out.println("celsius="+celsius);
}
public static void main(String args[])
{
Conversion m=new Conversion();
m.dollartorupee();
m.rupeetodollar();
m.kilometertometer();
m.metertokilometer();
m.celsiustofarenhenite();
m.farenhenitetoccelsius();
}
}
No comments:
Post a Comment