Wednesday, January 16, 2019
Prg420 V10 Week 4 Individual Assignment Essay
PRG420 (Version 10) Week 4 Individual- Simple Commission Calculation weapons platform sectionalization 3Modify the Week Three coffee berry application utilise Java NetBeans IDE to meet these supererogatory and changed business requirements* The application will right off compare the total yearly recompense of at least deuce changes reps. * It will calculate the additional amount of gross revenue that each salesperson must achieve to match or exceed the higher of the two earners. * The application should ask for the lean of each salesperson being compared.The Java application should overly meet these technical requirements* The application should have at least one crystallise, in addition to the applications do arcminuteeering syndicate. * The source code must demonstrate the use of Array or ArrayList. * There should be proper documentation in the source code. reference book Code/***Program Simple Commission Calculation Program vocalization 3Purpose to calculates and display the total yearly compensation of a salesperson. ProgrammerClass PRG420InstructorCreation DateProgrammer accommodation DatePurpose to add name of sales person and also functionality to manage the itemization of sales persons an comparing their annual compensation Program Summary This program will calculate and display the total annual compensation of a salesperson. Here in this program the salary of the salesman and its charge rate is fixe and program accepts sales amount.*/import java.util.ArrayListimport java.util.Scannerimport java.text.NumberFormatclass SalesPerson surreptitious final range of a function fixed_Salary = 35750.00private final reiterate commission_Rate = 12.0private final treble sales_Target = 125250.00private reap nameprivate double annual_Sales//default builder ordinary SalesPerson() name = Unknownannual_Sales = 0.0//parameterized constructor prevalent SalesPerson(String nm,double aSale) name = nmannual_Sales = aSale//getter method for the namepub lic String get nominate()return name//setter method to set namepublic void setName(String nm)name = nm//getter method for the annual salespublic double getAnnualSales()return annual_Sales//method to set the value of annual salepublic void setAnnualSales(double aSale) annual_Sales = aSale//method to calcualte and get commissionpublic double commission ()double commission = 0if(annual_Sales>= (sales_Target*(80/100))) //80% of the sales brandif(annual_Sales>= sales_Target)commission = sales_Target * (commission_Rate/100.0) + (annual_Sales- sales_Target)* (75.0/100.0) elsecommission = annual_Sales * (commission_Rate/100.0) return commission //method to calcualte and get annual compensationpublic double annualCompensation ()return fixed_Salary + commission()public class master(prenominal) public static void main(String args)//array list to have a collection of sales personsArrayList<SalesPerson> sales_Persons = new ArrayList<SalesPerson>()//create an physical object of Sca nner calss to get the keyboard input Scanner input = new Scanner(System.in)do// affect the user to enter nameSystem.out.print(Enter salesperson name (stop to EXIT) ) String name = input.nextLine().trim()if(name.equalsIgnoreCase(stop))break//creating an object of SalesPerson classSalesPerson sales_Person = new SalesPerson()//set name of sales personsales_Person.setName(name)//prompt the user to enter the annual salesSystem.out.print(Enter the annual sales )double sale = input.nextDouble()//set the value of annual sale of sales person object sales_Person.setAnnualSales(sale)//add sales Person to array listsales_Persons.add(sales_Person)//read a blank lineinput.nextLine()while(true)//getting the 2 minimum annual compensationdouble min = -1double secondMin = -1if(sales_Persons.size()>=3)//intilizationdouble firstValue = sales_Persons.get(0).annualCompensation() double secondValue = sales_Persons.get(1).annualCompensation()//intechanging if in reverse orederif (firstValue < second Value) min = firstValuesecondMin = secondValueelse min = secondValuesecondMin = firstValuedouble nextElement = -1//compring the 2 to n valuesfor (int i = 2 i < sales_Persons.size() i++) nextElement = sales_Persons.get(i).annualCompensation() if (nextElement < min) secondMin = minmin = nextElementelse if (nextElement < secondMin) secondMin = nextElement//displaying resultNumberFormat nf = NumberFormat.getCurrencyInstance()//All salespersons and their total annual compensation System.out.println(n)System.out.printf(String.format(%-20s%-20s,Name, Total annual compensation )) System.out.println()for(SalesPerson salesperson sales_Persons)System.out.printf(String.format(%-20s%20s,salesperson.getName(), nf.format(salesperson.annualCompensation()))) System.out.println()//dipslyaing the all sales persons additional amount of sales other the 2 memebrs who have minimum sales System.out.println(n)for(int i=0 i< sales_Persons.size()i++)double compensation = sales_Persons.get(i).annualCo mpensation()if(compensation == min compensation == secondMin) continueSystem.out.println(Name of Salesperson +sales_Persons.get(i).getName()) System.out.println(The total annual compensation +nf.format(compensation))System.out.println(Total SalestTotal Compensation)double sale = sales_Persons.get(i).getAnnualSales() for(double j =sale j<= (sale+ sale * 0.5) j+= 5000.0 ) sales_Persons.get(i).setAnnualSales(j)System.out.println(nf.format(j)+t+nf.format(sales_Persons.get(i).annualCompensation())) System.out.println()
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment