The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
We chatted last night and you said you'd like to help me with my Week 4 Assignment. Â I am attaching it. Â Do you need my Week 3 assignments, or do you still have them?
Â
Modify the Week Three Java application using NetBeans IDE to meet these additional and changed business requirements:
The Java application should also meet these technical requirements:
Â
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* Class SalesCommission
*
*
*
* Main class to initiate a terminal application allowing sales employees to
* calculate expected salary after commission.
*
*
*
* @package Sales Commission Calculator
*
*
* @author Robin Mathers * @course PRG/420
*
*
*/
public class SalesCommission {
/**
*
*
* Initialize the program.
*
*
* @param args Application arguments.
*
*
*/
public static void main(String args) {
// Initiate sales person class.
SalesPerson salesPerson = new SalesPerson();
// Request user to enter current annual sales amount.
System.out.print("Enter your current annual sales: $");
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(System.in));
// Initiate string value to be read from terminal. String
annualSalesInput;
// Use boolean to track if we can move on to calculations.
boolean validEntry = false;
// Keep prompting for data until we get an integer or double.
while (!validEntry) {
try {
// Begin to read the user's input.
String annualSalesInput = bufferedReader.readLine(); IOException. try {
// If the input cannot be converted to a double, throw salesPerson.setAnnualSales(Double.parseDouble(annualSalesInput));
// Print out the data user is looking for.
System.out.println("Current salary: $" +
salesPerson.getSalary()); System.out.println("Estimated amount from commission: $" +
salesPerson.getCommissionAmount());
System.out.println("Total compensation is expected to be: $"
+ salesPerson.getCompensation());
//potential sales
System.out.println("Total Sales\tTotal compensation: ");
double target = 1.5 * Double.parseDouble(annualSalesInput);
// for loop with +5000 increments from current sales to
target
for (double x = Double.parseDouble(annualSalesInput); x <=
target; x += 5000) {
salesPerson.setAnnualSales(x);
System.out.println(x + "\t" +
salesPerson.getCompensation());
}
validEntry = true;
} catch (NumberFormatException e) {
SalesCommission.showWarning();
}
} catch (IOException e) {
SalesCommission.showWarning();
}
} } /**
*
*
* Static method for returning error message on bad input.
*/
protected static void showWarning() {
System.out.println("Sorry, that doesn't appear to be proper format. Try
again:");
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* Robin Mathers * @course PRG/420
*/
public class SalesPerson {
//declare variables
double fixedSalary=50000.00;
double incentive = 80;
double salesTarget = 120000;
double accelerationFactor = 1.25;
double percentageCommission = 15;
double totalCommision = 0;
double sales = 0;
//getter and setter methods
public void setAnnualSales(double sales){
this.sales = sales;
}
public double getSalary(){
return this.fixedSalary;
}
public double getCommissionAmount()
{
/** This getCommision() the salesperson sales value and calculate
commission*/
//check if sales target is exceeded
if (sales >+ salesTarget){
totalCommision = (sales * (percentageCommission / 100 *
accelerationFactor));
}
//salesperson has come close to 80 but hasn't exceeded target
if (sales<=salesTarget && sales>=(incentive /100 * salesTarget)){
totalCommision = (percentageCommission * sales / 100);
}
return totalCommision;
}
public double getCompensation(){
/**
getCompensation() will take in sales and calculate the total
compensation of a salesPerson
**/
return getCommissionAmount()+ fixedSalary;
}
}
-----------