Answer to Question #279793 in Java | JSP | JSF for byybo123

Question #279793

Build a class Member that has id, name and payment rate. Write a class ContractMember that extends Member

a.        Provide a data member contractStart and contractEnd (LocalDateTime) 

b.       Provide a static constant TAXRATE and initialize it to 0.07

c.        Provide getters, setters and appropriate constructors

d.       Override the method calculateSalary which calculates the salary by finding the number of days between the start and end of the contract and callculating the salary for these days @ of the rate defined earlier. The method then deducts tax from this amount @ the TAXRATE and returns the net payable amount as salary

e.        Override the toString to match the output 


1
Expert's answer
2021-12-15T07:00:11-0500


package payment;


import java.util.Date;
import java.util.concurrent.TimeUnit;




public class Payment {


   private int  id;
   private String name;
   private double  payment_rate;
    public static void main(String[] args) {
      
    }
    
}
 class ContractMember  extends Payment{
     private Date contractStart, contractEnd;
     final  static double TAXRATE = 0.07 ;
     
     public  double calculateSalary(Date date1, Date date2, TimeUnit timeUnit) {
    long diffInMillies = contractEnd.getTime() - contractStart.getTime();
     double d= (double) timeUnit.convert(diffInMillies,TimeUnit.DAYS);
    return d;
}
 void setContractStart(Date d){
     contractStart = d;
 }   


void setContractEnd(Date d){
     contractEnd = d;
 }  


Date getContractEnd(){
    return contractStart;
}


Date getContractStart(){
    return contractStart;
}


public String toString(){
    return String.valueOf(TAXRATE) ;
}
 }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog