Answer:
// SAVE IN Division.java
public abstract class Division
{
protected String name;
protected String account_number;
public Division(String nam,String ac)
{
name = nam;
account_number = ac;
}
public abstract void display();
}
// END OF Division.java
// SAVE IN InternationalDivision.java
public class InternationalDivision extends Division
{
private String country;
private String language;
public InternationalDivision(String nam, String ac,String country,String lan)
{
super(nam,ac);
this.country = country;
this.language = lan;
}
public void display()
{
System.out.println( " name of company is " + name);
System.out.println( " Account number of company is " + account_number);
System.out.println( " company located in " + country);
System.out.println( " people in that company speak " + language);
}
}
// END OF InternationalDivision.java
// SAVE IN DomesticDivision.java
public class DomesticDivision extends Division
{
private String state;
public DomesticDivision(String nam, String ac,String sta)
{
super(nam,ac);
state = sta;
}
public void display()
{
System.out.println( " name of company is " + name);
System.out.println( " Account number of company is " + account_number);
System.out.println( " company located in the state " + state);
}
}
// END OF DomesticDivision.java
// SAVE IN UseDivision.java
public class UseDivision
{
public static void main(String[] args)
{
InternationalDivision ID1 = new InternationalDivision("Hero","11223344","China","Chinesse");
ID1.display();
System.out.println();
InternationalDivision ID2 = new InternationalDivision("Honda","1122334455","Singapore","Tamil");
ID2.display();
System.out.println();
DomesticDivision DD1 = new DomesticDivision("Ford","77223344","Arizona");
DD1.display();
System.out.println();
DomesticDivision DD2 = new DomesticDivision("Maruti","6188994455","Alaska");
DD2.display();
}
}
// END OF UseDivision.java