Professional Documents
Culture Documents
import java.util.*;
class Account
String holderName;
Long accountNumber;
String IFSCCode;
Long contactNumber;
return holderName;
this.holderName=h;
return accountNumber;
this.accountNumber=s;
return IFSCCode;
}
this.IFSCCode=i;
return contactNumber;
this.contactNumber=c;
this.holderName = holderName;
this.accountNumber = accountNumber;
this.IFSCCode = IFSCCode;
this.contactNumber = contactNumber;
System.out.println(holderName+","+accountNumber+","+IFSCCode+","+contactNumber);
double interestRate;
return interestRate;
this.interestRate=d;
this.holderName = holderName;
this.accountNumber = accountNumber;
this.IFSCCode = IFSCCode;
this.contactNumber = contactNumber;
this.interestRate = interestRate;
System.out.println("Holder Name:"+holderName);
System.out.println("Account number:"+accountNumber);
System.out.println("IFSC code:"+IFSCCode);
System.out.println("Contact Number:"+contactNumber);
System.out.println("Interest Rate:"+interestRate);
}
String organizationName;
Long TIN;
this.holderName = holderName;
this.accountNumber = accountNumber;
this.IFSCCode = IFSCCode;
this.contactNumber = contactNumber;
this.organizationName = organizationName;
this.TIN = TIN;
System.out.println("Holder Name:"+holderName);
System.out.println("Account number:"+accountNumber);
System.out.println("IFSC code:"+IFSCCode);
System.out.println("Contact Number:"+contactNumber);
System.out.println("TIN:"+TIN);
}
}
class Main
ac.method1(Name,accNo,ifsc,conNo);
ac.display();
switch(type){
case "savings":
double ir = sc.nextDouble();
sa.method2(Name,accNo,ifsc,conNo,ir);
sa.display();
break;
case "current":
CurrentAccount ca = new CurrentAccount();
ca.method3(Name,accNo,ifsc,conNo,org,tin);
ca.display();
break;
default:
}
//shapes
import java.util.*;
double a,b;
void calculatePerimeter()
System.out.println("Enter radius:");
a=in.nextDouble();
void calculatePerimeter()
a=in.nextDouble();
System.out.println("\nEnter bredth:");
b=in.nextDouble();
void calculatePerimeter()
System.out.println("Enter side:");
a=in.nextDouble();
class Main
{
System.out.println("List of shapes: ");
System.out.println("1.Circle");
System.out.println("2.Rectangle");
System.out.println("3.Square");
int n = sc.nextInt();
Shape obj;
switch(n)
case 1:
obj.calculatePerimeter();
break;
case 2:
obj.calculatePerimeter();
break;
case 3:
obj.calculatePerimeter();
break;
}
//aircraft
import java.util.*;
class Aircraft
String aircraftName;
String source;
String destination;
this.aircraftName=aircraftName;
this.source=source;
this.destination=destination;
void displayDetails()
String checkinbeforetwohours;
int noOfKgsallowed;
float additionalFeesperkg;
return checkinbeforetwohours;
this.checkinbeforetwohours=b;
}
public int getnoOfKgsallowed(){
return noOfKgsallowed;
this.noOfKgsallowed = i;
return additionalFeesperkg;
this.additionalFeesperkg = f;
}
void method2(String aircraftName,String source,String destination,String checkinbeforetwohours,int
noOfKgsallowed,float additionalFeesperkg){
this.aircraftName = aircraftName;
this.source = source;
this.destination = destination;
this.checkinbeforetwohours = checkinbeforetwohours;
this.noOfKgsallowed = noOfKgsallowed;
this.additionalFeesperkg = additionalFeesperkg;
void displayDetails()
System.out.println("Source: "+source);
System.out.println("Destination: "+destination);
}
class PrivateAircraft extends Aircraft
String checkinbeforetwohours;
String pilotPreference;
String purpose;
return checkinbeforetwohours;
this.checkinbeforetwohours = b;
}
public String getpilotPreference(){
return pilotPreference;
this.pilotPreference = s;
return purpose;
this.purpose = ss;
}
this.aircraftName = aircraftName;
this.source = source;
this.destination = destination;
this.checkinbeforetwohours = checkinbeforetwohours;
this.pilotPreference = pilotPreference;
this.purpose = purpose;
void displayDetails()
System.out.println("Source: "+source);
System.out.println("Destination: "+destination);
System.out.println("Purpose: "+purpose);
}
public class Main extends Aircraft
ac.displayDetails();
int n = sc.nextInt();
switch(n){
case 1:
PublicAircraft obj1 = new PublicAircraft();
System.out.println("Public Aircraft");
obj1.displayDetails();
break;
case 2:
obj2.method3("Spice jet","Chennai","Bangalore","NO",nameOfPilot,purpose);
System.out.println("Private Aircraft");
obj2.displayDetails();
break;