to get output regarding the keyword given
class Accregistration
{
String cust_name;
String cust_age;
String Acc_type;
String cust_occupation;
String nation;
String a,b,c,d,e;
void print()
{
System.out.println("cust_name:");
System.out.println("cust_age:");
System.out.println("Acc_type:");
System.out.println("cust_occupation:");
System.out.println("nation:");
}
}
class Customer1 extends Accregistration
{
String cust_name="RAHUL MAHAJAN";
String cust_age="24/12/1965";
String Acc_type="savings" ;
String cust_occupation="UNEMPLOYED";
String nation="indian";
void print()
{
System.out.println("CUSTOMER NAME: " cust_name);
System.out.println("CUSTOMER DOB: " cust_age);
System.out.println("ACCOUNT TYPE: " Acc_type);
System.out.println("CUSTOMER OCCUPATION: " cust_occupation);
System.out.println("CUSTOMER BELONGS TO: " nation);
}
}
class Customer2 extends Accregistration
{
String cust_name="MICHAEL JACKSON";
String cust_age="14/06/1960";
String Acc_type="CURRENT" ;
String cust_occupation="MUSICIAN";
String nation="American";
void print()
{
System.out.println("CUSTOMER NAME: " cust_name);
System.out.println("CUSTOMER DOB: " cust_age);
System.out.println("ACCOUNT TYPE: " Acc_type);
System.out.println("CUSTOMER OCCUPATION: " cust_occupation);
System.out.println("CUSTOMER BELONGS TO: " nation);
}
}
class Customer3 extends Accregistration
{
String cust_name="SACHIN TENDULKAR";
String cust_age="14/07/1974";
String Acc_type="savings" ;
String cust_occupation="CRICKETER";
String nation="indian";
void print()
{
System.out.println("CUSTOMER NAME: " cust_name);
System.out.println("CUSTOMER DOB: " cust_age);
System.out.println("ACCOUNT TYPE: " Acc_type);
System.out.println("CUSTOMER OCCUPATION: " cust_occupation);
System.out.println("CUSTOMER BELONGS TO: " nation);
}
}
class Customer4 extends Accregistration
{
String cust_name="RAJANI KANTH";
String cust_age="12/12/1940";
String Acc_type="CURRENT" ;
String cust_occupation="ACTOR";
String nation="indian";
void print()
{
System.out.println("CUSTOMER NAME: " cust_name);
System.out.println("CUSTOMER DOB: " cust_age);
System.out.println("ACCOUNT TYPE: " Acc_type);
System.out.println("CUSTOMER OCCUPATION: " cust_occupation);
System.out.println("CUSTOMER BELONGS TO: " nation);
}
}
class Customer5 extends Accregistration
{
String cust_name="NELSOM MANDELA";
String cust_age="12/01/1930";
String Acc_type="savings" ;
String cust_occupation="RETIRED";
String nation="American";
void print()
{
System.out.println("CUSTOMER NAME: " cust_name);
System.out.println("CUSTOMER DOB: " cust_age);
System.out.println("ACCOUNT TYPE: " Acc_type);
System.out.println("CUSTOMER OCCUPATION: " cust_occupation);
System.out.println("CUSTOMER BELONGS TO: " nation);
}
}
class Bankdet
{
public static void main(String [] args)
{
//String Acc_type,savings,CURRENT;
int i;
Accregistration info[]=new Accregistration[5];
info[0]=new Customer1();
info[1]=new Customer2();
info[2]=new Customer3();
info[3]=new Customer4();
info[4]=new Customer5();
for(i=0;i<5;i )
info[i].print();
/**String Acc_type="savings";
if(Acc_type==savings){
System.out.println(info[0],info[2],info[4]);}
else if(Acc_type==CURRENT){
System.out.println(info[1],info[3]);}*/
}
}
here i've to get output according to the Acc_type assigned...can solve anybody plz.