NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

public class CommisionEmployee extends Object
{

private String firstName;
private String lastName;
private String socialSecurityNumber;
private double grossSales;
private double commissionRate;

public CommisionEmployee(String first, String last, String ssn,
double sales, double rate)
{
firstName=first;
lastName=last;
socialSecurityNumber=ssn;
grossSales=sales;
commissionRate=rate;
}

public void setFirstName(String first)
{
firstName=first;
}

public String getFirstName()
{
return firstName;
}

public void setLastName(String last)
{
lastName=last;
}

public String getLastName()
{
return lastName;
}

public void setSocialSecurityNumber(String ssn)
{
socialSecurityNumber=ssn;
}

public String getSocialSecurityNumber()
{
return socialSecurityNumber;
}


public void setGrossSales(double sales)
{
if (sales>=0.0)
grossSales=sales;
else
throw new IllegalArgumentException("Satış>=0 olmalıdır");
}

public double getGrossSales()
{
return grossSales;
}

public void setCommissionRate(double rate)
{
if (rate>0.0 && rate<1.0)
commissionRate=rate;
else
throw new IllegalArgumentException("Komisyon>=0 olmalıdır");
}

public double getCommissionRate()
{
return commissionRate;
}

public double earning()
{
return grossSales*commissionRate;
}

public String toString()
{
return String.format("%s: %s %sn%s: %sn%s: %.2fn%s: %.2f",
"Komisyonlu işçi",firstName,lastName,"SSK No:",socialSecurityNumber,
"Toplam satış",grossSales,
"Komisyon Oranı",commissionRate);
}


}

public class CommisionEmployeeTest
{
public static void main(String[] args)
{
CommisionEmployee employee=new CommisionEmployee(
"Faruk","Taş","222-22-2222",10000,.06);
System.out.println("get metodu ile işçi bilgileri");
System.out.printf("%s %sn","İsim:",employee.getFirstName());
System.out.printf("%s %sn","Soyisim:",employee.getLastName());
System.out.printf("%s %sn","SSKno:",employee.getSocialSecurityNumber());
System.out.printf("%s %.2fn","Satış:",employee.getGrossSales());
System.out.printf("%s %.2fn","Komisyon:",employee.getCommissionRate());
System.out.printf("%s %.2fn","Kazanç:",employee.earning());

employee.setGrossSales(500);
employee.setCommissionRate(.1);
System.out.printf("n%s:nn%sn","Yeni bilgiler toString ile",employee);
}

}

public class BasePlusCommissionEmployee
{
private String firstName;
private String lastName;
private String socialSecurityNumber;
private double grossSales;
private double commissionRate;
private double baseSalary;

public BasePlusCommissionEmployee(String first, String last, String ssn,
double sales, double rate, double salary)
{
firstName=first;
lastName=last;
socialSecurityNumber=ssn;
grossSales=sales;
commissionRate=rate;
baseSalary=salary;
}

public void setFirstName(String first)
{
firstName=first;
}

public String getFirstName()
{
return firstName;
}

public void setLastName(String last)
{
lastName=last;
}

public String getLastName()
{
return lastName;
}

public void setSocialSecurityNumber(String ssn)
{
socialSecurityNumber=ssn;
}

public String getSocialSecurityNumber()
{
return socialSecurityNumber;
}


public void setGrossSales(double sales)
{
if (sales>=0.0)
grossSales=sales;
else
throw new IllegalArgumentException("Satış>=0 olmalıdır");
}

public double getGrossSales()
{
return grossSales;
}

public void setCommissionRate(double rate)
{
if (rate>0.0 && rate<1.0)
commissionRate=rate;
else
throw new IllegalArgumentException("Komisyon>=0 olmalıdır");
}

public double getCommissionRate()
{
return commissionRate;
}


public void setBaseSalary(double salary)
{
if (salary>=0.0)
baseSalary=salary;
else
throw new IllegalArgumentException("Maaş>=0 olmalıdır");
}

public double getBaseSalary()
{
return baseSalary;
}


public double earning()
{
return baseSalary+(grossSales*commissionRate);
}

public String toString()
{
return String.format("%s: %s %sn%s: %sn%s: %.2fn%s: %.2fn%s: %.2f",
"Komisyonlu işçi",firstName,lastName,"SSK No:",socialSecurityNumber,
"Toplam satış",grossSales,
"Komisyon Oranı",commissionRate,
"Taban Maaş",baseSalary);
}

}

public class BasePlusCommissionEmployeeTest
{
public static void main(String[] args)
{
BasePlusCommissionEmployee employee=new BasePlusCommissionEmployee(
"Faruk","Taş","222-22-2222",10000,.06,300);
System.out.println("get metodu ile işçi bilgileri");
System.out.printf("%s %sn","İsim:",employee.getFirstName());
System.out.printf("%s %sn","Soyisim:",employee.getLastName());
System.out.printf("%s %sn","SSKno:",employee.getSocialSecurityNumber());
System.out.printf("%s %.2fn","Satış:",employee.getGrossSales());
System.out.printf("%s %.2fn","Komisyon:",employee.getCommissionRate());
System.out.printf("%s %.2fn","Maaş:",employee.getBaseSalary());
System.out.printf("%s %.2fn","Kazanç:",employee.earning());

employee.setGrossSales(500);
employee.setCommissionRate(.1);
System.out.printf("n%s:nn%sn","Yeni bilgiler toString ile",employee);
}


}

public class BasePlusCommissionEmployee1 extends CommisionEmployee
{
private double baseSalary;

public BasePlusCommissionEmployee1(String first, String last, String ssn,
double sales, double rate, double salary)
{
super(first,last,ssn,sales,rate);
setBaseSalary(salary);
}

public void setBaseSalary(double salary)
{
if (salary>=0.0)
baseSalary=salary;
else
throw new IllegalArgumentException("Maaş>=0 olmalıdır");
}

public double getBaseSalary()
{
return baseSalary;
}

@Override
public double earning()
{
return baseSalary+(getGrossSales()*getCommissionRate());
}

@Override
public String toString()
{
return String.format("%s: %s %sn%s: %sn%s: %.2fn%s: %.2fn%s: %.2f",
"Komisyonlu işçi",getFirstName(),getLastName(),"SSK No:",getSocialSecurityNumber(),
"Toplam satış",getGrossSales(),
"Komisyon Oranı",getCommissionRate(),
"Taban Maaş",getBaseSalary());
}


}

public class BasePlusCommissionEmployee1Test
{
public static void main(String[] args)
{
BasePlusCommissionEmployee1 employee=new BasePlusCommissionEmployee1(
"Faruk","Taş","222-22-2222",10000,.06,300);
System.out.println("get metodu ile işçi bilgileri");
System.out.printf("%s %sn","İsim:",employee.getFirstName());
System.out.printf("%s %sn","Soyisim:",employee.getLastName());
System.out.printf("%s %sn","SSKno:",employee.getSocialSecurityNumber());
System.out.printf("%s %.2fn","Satış:",employee.getGrossSales());
System.out.printf("%s %.2fn","Komisyon:",employee.getCommissionRate());
System.out.printf("%s %.2fn","Maaş:",employee.getBaseSalary());
System.out.printf("%s %.2fn","Kazanç:",employee.earning());

employee.setGrossSales(500);
employee.setCommissionRate(.1);


System.out.printf("n%s:nn%sn","Yeni bilgiler toString ile",employee);

}


}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.