Oop Assi Empoyee
Oop Assi Empoyee
SP18-BSE-108
Runner:
package lab7polymorphism;
/**
* @author Lenovo
*/
/**
*/
for(int i=0;i<employees.length;i++){
System.out.println(employees[i].earning());
System.out.println("\n");
emplpoyees1.setbaseSalary((10 * (emplpoyees1.getbaseSalaray())));
System.out.println(employees[i].earning());
package lab7polymorphism;
/**
* @author Lenovo
*/
public Employee(){
firstName = null;
lastName = null;
SSN = 0;
firstName = fn;
lastName = ln;
SSN = ssn;
}
System.out.println("First Name : " + firstName + "Last Name : " + lastName + "SSN : " + SSN);
package lab7polymorphism;
/**
* @author Lenovo
*/
public basepluscomissionemploee(){
super();
basicSalary = 0;
public basepluscomissionemploee(String fn,String ln, int ssn, int s, int cr, int bs){
super(fn,ln,ssn,s,cr);
basicSalary = bs;
super.display();
return super.earning()*basicSalary;
return basicSalary;
basicSalary = a;
package lab7polymorphism;
/**
* @author Lenovo
*/
public comissionEmployee(){
super();
sales = 0;
comissionRate = 0;
sales = s;
comissionRate = cr;
return sales*comissionRate;
super.display();
package lab7polymorphism;
/**
* @author Lenovo
*/
int hours;
int wagePerHour;
public hourlyemployee(){
super();
hours = 0;
wagePerHour = 0;
}
super(fn,ln,ssn);
hours = h;
wagePerHour = wph;
return hours*wagePerHour;
super.display();
/*
*/
package lab7polymorphism;
/**
* @author Lenovo
*/
public weeklyEmployee(){
super();
weeklysalary = 0;
super(fn,ln,ssn);
weeklysalary = ws;
return weeklysalary;
super.display();
Programn 2
Runner:
package lab7polymorphismq2;
for(int i=0;i<a.length;i++){
System.out.println(a[i].calculateCost());
System.out.println("");
package lab7polymorphismq2;
public abstract class package1 {
protected String senderName;
protected String recieverName;
protected String senderAddress;
protected String recieverAddress;
protected double weightInOunce;
protected double costPerOunce;
public package1(){
senderName = null;
recieverName = null;
senderAddress = null;
recieverAddress = null;
weightInOunce = 0;
costPerOunce = 0;
}
public package1(String sn,String rn,String sa, String ra,double w,double c){
senderName = sn;
recieverName = rn;
senderAddress = sa;
recieverAddress = ra;
weightInOunce = w;
costPerOunce = c;
}
public void display(){
System.out.println("sender name : " + senderName);
System.out.println("recieverName : " + recieverName);
System.out.println("senderAddress : " + senderAddress);
System.out.println("recieverAddress : " + recieverAddress);
System.out.println("weightInOunce : " + weightInOunce);
System.out.println("costPerOunce : " + costPerOunce);
}
public double calculateCost(){return weightInOunce*costPerOunce;}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lab7polymorphismq2;
/**
*
* @author Lenovo
*/
public class overnightPackage extends package1{
double additionalFee;
public overnightPackage(){
super();
additionalFee = 0;
}
public overnightPackage(String sn,String rn,String sa, String ra,double w,double c,double af){
super(sn,rn,sa,ra,w,c);
}
package lab7polymorphismq2;
Program 3
package lab7polymorphismq3;
System.out.println(mig[i].calculateFees());
System.out.println(mig[0].Compare_Movies(mig[2]));
emp.SetTitle("Cry");
System.out.println("Movie = " );
mig[i]=emp;
System.out.println(mig[i].GetTitle());
package lab7polymorphismq3;
Movie(){
}
Movie(int id , String ma , int dd){
ID =id ;
title =i ;
days =i ;
return ID;
return title;
return days;
if(title.equalsIgnoreCase(mig.title)){
return true;
}else{
return false;
}
package lab7polymorphismq3;
Action(){
super(id , m , d);
package lab7polymorphismq3;
Comedy(){
super(id , m , d);
}
package lab7polymorphismq3;
Drama(){
super(id , m , d);