package cheggjan20;public class BasePlusCommissionEmployee { int employeeID; String firstName; String lastName; double baseSalary; int grossSales; double commisionRate; //parameterised constructors BasePlusCommissionEmployee(int employeeID,String firstName,String lastName) { if(employeeID>0) {this.employeeID=employeeID;} if(firstName!=null) {this.firstName=firstName;} if(lastName!=null) {this.lastName=lastName;} } BasePlusCommissionEmployee(int employeeID,String firstName,String lastName,double baseSalary,int grossSales,double commisionRate) { if(employeeID>0) {this.employeeID=employeeID;} if(firstName!=null) {this.firstName=firstName;} if(lastName!=null) {this.lastName=lastName;} if(commisionRate>=0.1 && commisionRate0) { this.baseSalary = baseSalary; } else this.
baseSalary=200.00; if(grossSales!=0) this.grossSales = grossSales; } //getters and setters public int getEmployeeID() { return employeeID; } public int getGrossSales() { return grossSales; } public void setGrossSales(int grossSales) { if(grossSales!=0) this.grossSales = grossSales; } public double getCommisionRate() { return commisionRate; } public void setCommisionRate(int commisionRate) { if(commisionRate>=0.1 && commisionRate0) { this.employeeID = employeeID; }} public void setFirstName(String firstName) { if(firstName!=null) { this.firstName = firstName; } } public void setLastName(String lastName) { if(lastName!=null) { this.lastName = lastName; } } public void setBaseSalary(double baseSalary) { if(baseSalary>0) { this.baseSalary = baseSalary; } else this.baseSalary=200.00; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public double getBaseSalary() { return baseSalary; } public double earnings()//to calculate earnings { return commisionRate*grossSales+baseSalary; } public String toString()//to print details { return “nEmployee Id : “+employeeID+”nFirst Name: “+firstName+”nLast Name : “+lastName+”nBase Salary : $”+baseSalary+”nGross Sales : $”+grossSales+”nCommision Rate : “+commisionRate+”%”; } }BasePlusCommissionEmployeeTest.javapackage cheggjan20;public class BasePlusCommissionEmployeeTest { public static void main(String[] args) { // TODO Auto-generated method stub //creating objects BasePlusCommissionEmployee e1=new BasePlusCommissionEmployee(121,”Nick”,”Jonas”,30000,300,20); BasePlusCommissionEmployee e2=new BasePlusCommissionEmployee(123,”Priyanka”,”Jonas”,40000,400,20); //displaying details System.out.println(e1); System.out.println(“Total Commision : $”+e1.
earnings()); System.out.println(e2); System.out.println(“Total Commision : $”+e2.earnings()); }}Output is :Employee Id : 121First Name: NickLast Name : JonasBase Salary : $30000.0Gross Sales : $300Commision Rate : 0.1%Total Commision :30030.0Employee Id : 123First Name: PriyankaLast Name : JonasBase Salary : $40000.0Gross Sales : $400Commision Rate : 0.1%Total Commision :40040.0CheckingAccount.javapackage cheggjan20;public class CheckingAccount { int accountNumber; String customerName; double accountBalance; //parameterised constructor CheckingAccount(int ac,String cname,double balance) { accountNumber=ac; customerName=cname; accountBalance=balance; } //getters and setters public int getAccountNumber() { return accountNumber; } public String getCustomerName() { return customerName; } public double getAccountBalance() { return accountBalance; } public void setAccountBalance(double accountBalance) { if(accountBalance>50.00)//it should always be greater than that this.accountBalance = accountBalance; } public double withdraw (double amount)//to withdraw ammount and return balance { if((accountBalance-amount-2)>=50.00) accountBalance=accountBalance-amount-2; return accountBalance; } public String toString()//to display details { return “Account Number : “+accountNumber+”nCustomer Name : “+customerName+”nAccount Balance : $”+accountBalance; } }CheckingAccountTest.javapackage cheggjan20;public class CheckingAccountTest { public static void main(String args[]) {//creating objects CheckingAccount c1=new CheckingAccount(121,”Nick”,600.00); CheckingAccount c2=new CheckingAccount(122,”Nickos”,700.00); //displaying details System.out.println(c1); System.out.println(“Balance after withdrawl of $200 is : $”+c1.withdraw(200)); System.out.println(c2); System.out.println(“Balance after withdrawl of $400 is : $”+c2.withdraw(400)); }}
Remember! This is just a sample.
You can get a custom paper by one of our expert writers.
Get your custom essay
Helping students since 2015
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download