Wednesday, July 17, 2019

Prg420 V10 Week 4 Individual Assignment Essay

PRG420 (Version 10) Week 4 Individual- mere(a) management Calculation course mathematical function 3Modify the Week Three chocolate application using Java NetBeans IDE to fulfil these sumal and changed business requirements* The application go out now compare the marrow one-year stipend of at least deuce gross gross gross revenue psyches. * It will inscribe the additional stir up of trades that each salesperson essential achieve to match or exceed the higher of the two earners. * The application should gestate for the prepare of each salesperson world compared.The Java application should also refer these technical requirements* The application should arrive at at least one class, in addition to the applications controlling class. * The germ code must demonstrate the make use of of Array or ArrayList. * There should be proper documentation in the beginning code.Source Code/***Program Simple Commission Calculation Program Part 3 exercise to calculates and display the total yearbook recompense of a salesperson. curriculummerClass PRG420InstructorCreation construeProgrammer Modification DatePurpose to add hit of sales person and also functionality to manage the list of sales persons an comparing their annual requital Program Summary This program will calculate and display the total annual pay of a salesperson. Here in this program the salary of the salesman and its electric charge rate is fixe and program accepts sales amount.*/ mo java.util.ArrayListimport java.util.Scannerimport java.text.NumberFormatclass sales representative toffee-nosed nett bifurcate fixed_Salary = 35750.00private final reiterated commissioning_Rate = 12.0private final in two ways sales_Target = 125250.00private String get toprivate double annual_Sales//default constructor man SalesPerson() name = Unknownannual_Sales = 0.0//parameterized constructor semi human race SalesPerson(String nm,double aSale) name = nmannual_Sales = aSale//getter manner for the name everyday String get recognize()return name// sightter method to set namepublic deflect setName(String nm)name = nm//getter method for the annual salespublic double getAnnualSales()return annual_Sales//method to set the nurse 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 object lensif(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 wagespublic double annual fee ()return fixed_Salary + commission()public class Main public nonoperational void main(String args)//array list to have a collection of sales personsArrayList sales_Persons = pertly ArrayList()//create an object of Scanner calss to get the keyboard input Scanner input = immature Scanner(System.in)do//prompt the user to lay nameSystem.out.print(Enter salesperson name (stop to EXIT) ) String name = input.nextLine().trim()if(name.equalsIgnoreCase(stop)) present//creating an object of SalesPerson classSalesPerson sales_Person = new SalesPerson()//set name of sales personsales_Person.setName(name)//prompt the user to record 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)// usher a blank lineinput.nextLine()while(true)// getting the 2 hourimum annual feedouble 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 secondValue) 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 terminationNumberFormat nf = NumberFormat.getCurrencyInstance()//All salespersons and their total annual stipend System.out.println()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()for(int i=0 i sales_Persons.size()i++)double compensation = sales_Persons.get(i).annualCompensation()if(compensation == min compensa tion == 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 SalesTotal Compensation)double sale = sales_Persons.get(i).getAnnualSales() for(double j =sale j

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.