import java.util.Scanner;
class conversion
{
static float dollartorupees()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the dollar");
float d=sc.nextFloat();
float r=d/50;
System.out.println("rupees ="+r);
return(r);
}
static float rupeestodollars()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the rupees");
float r=sc.nextFloat();
float d=r*50;
System.out.println("rupees ="+d);
return(d);
}
static float metertokilometer()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the meter");
float m=sc.nextFloat();
float km=m/1000;
System.out.println("rupees ="+m);
return(m);
}
static float kilometertometer()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the kilometer");
float km=sc.nextFloat();
float m=km*1000;
System.out.println("rupees ="+m);
return(m);
}
static float farenhitetocelcius()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the kilometer");
float f=sc.nextFloat();
float c=(5*(f-32))/9;
System.out.println("rupees ="+c);
return(c);
}
static float celciustofarenhite()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the celcius");
float c=sc.nextFloat();
float f=((9*c)/5)+32;
System.out.println("rupees ="+f);
return(f);
}
}
class testconversion extends conversion
{
public static void main(String[] arg)
{
conversion ob=new testconversion();
Scanner sc=new Scanner(System.in);
System.out.println("enter your choice");
int x=sc.nextInt();
if(x== 1)
ob.dollartorupees();
else if(x==2)
ob.rupeestodollars();
else if(x==3)
ob.metertokilometer();
else if(x==4)
ob.kilometertometer();
else if(x==5)
ob.farenhitetocelcius();
else if(x==6)
ob.celciustofarenhite();
else
System.out.println("wronghoice");
}
}
class conversion
{
static float dollartorupees()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the dollar");
float d=sc.nextFloat();
float r=d/50;
System.out.println("rupees ="+r);
return(r);
}
static float rupeestodollars()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the rupees");
float r=sc.nextFloat();
float d=r*50;
System.out.println("rupees ="+d);
return(d);
}
static float metertokilometer()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the meter");
float m=sc.nextFloat();
float km=m/1000;
System.out.println("rupees ="+m);
return(m);
}
static float kilometertometer()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the kilometer");
float km=sc.nextFloat();
float m=km*1000;
System.out.println("rupees ="+m);
return(m);
}
static float farenhitetocelcius()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the kilometer");
float f=sc.nextFloat();
float c=(5*(f-32))/9;
System.out.println("rupees ="+c);
return(c);
}
static float celciustofarenhite()
{ Scanner sc=new Scanner(System.in);
System.out.println("enter the celcius");
float c=sc.nextFloat();
float f=((9*c)/5)+32;
System.out.println("rupees ="+f);
return(f);
}
}
class testconversion extends conversion
{
public static void main(String[] arg)
{
conversion ob=new testconversion();
Scanner sc=new Scanner(System.in);
System.out.println("enter your choice");
int x=sc.nextInt();
if(x== 1)
ob.dollartorupees();
else if(x==2)
ob.rupeestodollars();
else if(x==3)
ob.metertokilometer();
else if(x==4)
ob.kilometertometer();
else if(x==5)
ob.farenhitetocelcius();
else if(x==6)
ob.celciustofarenhite();
else
System.out.println("wronghoice");
}
}
No comments:
Post a Comment