-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab5_3.java
50 lines (46 loc) · 1005 Bytes
/
Lab5_3.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.*;
abstract class Conversion
{
double amount;
abstract void MoneyConversion();
}
class RupeetoDollar extends Conversion
{
RupeetoDollar(double amount)
{
this.amount=amount;
}
double c1;
void MoneyConversion()
{
c1=amount*0.012;
System.out.println("Rs."+amount+" = "+c1+"$");
}
}
class RupeetoEuro extends Conversion
{
RupeetoEuro(double amount)
{
this.amount=amount;
}
double c1;
void MoneyConversion()
{
c1=amount*0.011;
System.out.println("Rs."+amount+" = "+c1+"Euro");
}
}
public class Lab5_3
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
double amt;
System.out.println("Enter amount");
amt=Double.parseDouble(sc.next());
RupeetoDollar ob1= new RupeetoDollar(amt);
ob1.MoneyConversion();
RupeetoEuro ob2= new RupeetoEuro(amt);
ob2.MoneyConversion();
}
}