import java.util.Scanner;
import java.text.NumberFormat;
class SalesPerson {
private final double fixed_Salary = 85000.00;
private final double commission_Rate = 20.0;
//default constructor
public SalesPerson() {
annual_Sales = 0.0;
}
//parameterized constructor
public SalesPerson(double aSale) {
annual_Sales = aSale;
}
//getter method for the annual sales
public double getAnnualSales(){
return annual_Sales;
}
//method to set the value of annual sale
public void setAnnualSales(double aSale) {
annual_Sales = aSale;
}
//method to calcualte and get commission
public double commission (){
return annual_Sales * (commission_Rate/100.0);
}
//method to calcualte and get annual compensation
public double annualCompensation (){
return fixed_Salary + commission();
}
}
public class Main {
public static void main(String args[]){
//create an object of Scanner calss to get the keyboard input
Scanner input = new Scanner(System.in);
//creating an object of SalesPerson class
SalesPerson sales_Person = new SalesPerson();
//prompt the user to enter the annual sales
System.out.print("Enter the annual sales : ");
double sale = input.nextDouble();
//set the value of annual sale of sales person object
sales_Person.setAnnualSales(sale);
NumberFormat nf = NumberFormat.getCurrencyInstance();
//displaying the report
System.out.println("The total annual compensation : "+nf.format(sales_Person.annualCompensation()));
}
}