hi
I havent been here for a long time. I really need some help. This program is just a practice on object oriented programming, dont have a fully understanding as yet but am trying.
I am doing this loan officer program. I dont know if I did the right thing, but am getting nothing as the output. the other problem is, can you show me an example of a constructor and how do i get a constructor to work. here is the codes, can u just tell me what else I am missing there and how to fix it.
I
import java.util.Scanner;
public class Loan
{
public static void main(String[]args)
{
Scanner scnr = new Scanner(System.in);
}
private String loanOfficerID;
private String fullName;
private String lastName;
private double loanInterest;
private double fixedSalary;
private double grossPay;
private final double healthSurcharge = 8.50;
private double totalDeduction;
private double NIS;
private double netpay;
private double hoursWork;
private double rateOfpay;
HealthSurcharge hs = new HealthSurcharge();
public String loanOfficerID()
{
return loanOfficerID;
}
public void setloanOfficerID(String loanOfficerID)
{
this.loanOfficerID = loanOfficerID;
}
public String getfullName()
{
return fullName;
}
public void setfullName(String fullName)
{
this.fullName = fullName;
}
public String getlastName()
{
return lastName;
}
public void setlastName(String lastName)
{
this.lastName = lastName;
}
public double gethoursWork()
{
hoursWork = hoursWork * rateOfpay;
return hoursWork;
}
public void sethourWork(double hoursWork)
{
this.hoursWork = hoursWork;
}
public double getloanInterest()
{
loanInterest = loanInterest * 0.3;
grossPay = loanInterest - grossPay;
return loanInterest;
}
public void setloanInterest(double loanInterest)
{
this.loanInterest = loanInterest;
}
public double getfixedSalary()
{
fixedSalary = fixedSalary - grossPay;
return fixedSalary;
}
public void setfixedSalary(double fixedSalary)
{
this.fixedSalary = fixedSalary;
}
public double gettotalDeduction()
{
totalDeduction = NIS + healthSurcharge;
return totalDeduction;
}
public void settotalDeduction(double totalDeduction)
{
this.totalDeduction = totalDeduction;
}
public double getnetpay()
{
netpay = totalDeduction - grossPay;
return netpay;
}
public void details()
{
System.out.println("The loan officer id number is: "+loanOfficerID);
System.out.println("The loan officer full name is: "+fullName);
System.out.println("The loan officer last name is: "+lastName);
System.out.println("The gross pay is: "+grossPay);
System.out.println("The total deduction is: "+totalDeduction);
System.out.println("The netpay is: "+netpay);
}
}
and this is the health surcharge class dont know if it this is the correct way to make a constructor please help
class HealthSurcharge
{
HealthSurcharge hs = new HealthSurcharge();//dont kno if this is the correct thing
}

