I am trying to write code to: Have a user input their desired salary and the pro
ID: 3638299 • Letter: I
Question
I am trying to write code to:
Have a user input their desired salary and the program output the sales amount needed to earn the commissions to meet that salary. I am getting so confused!?!?!
/*
*
*
*
*/
package salescommissionspart2;
import javax.swing.JOptionPane;
public class SalesCommissionsPart2
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// Commissions needed
// final double COMMISSIONS_NEEDED = 30000.00;
double commission_target = 0;
String input = (String)JOptionPane.showInputDialog(null,
"Input your target amount $$: ",
"Input amount",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"100");
input = input.trim();
// Remove the white spaces
if(input != null && input.length() > 0)
commission_target = 30000.00;
// Declare the commissions
double commissions = 0;
// Declare salesAmount
double salesAmount = 1;
// begin a while loop
while (commissions < commission_target)
{
// Calculate commissions
if (salesAmount >= 10001.00)
// Calculate te commissions if sales are less than 10000.00
{
commissions = 5000.00 * 0.08 + 5000.00 *0.10 +
(salesAmount - 10000.00) * 0.12;
// Use an else if statement
else if (salesAmount >=5001.00)
// Calculate commissions if sales are greater than 5000.00
{
commissions = 5000.00 * 0.08 +
(salesAmount - 5000.00) * 0.10;
}
// Use an else statement and calculate the commissions?
commissions = salesAmount * 0.08;
}
// With the salesAmount increasing
salesAmount++;
}
// End the while loop
// Display the sales amount
String output = "A sales amount" + salesAmount + " is needed to" +
"make a commission of $" + commission_target;
JOptionPane.showMessageDialog(null, output, "SALES",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
Explanation / Answer
if(((CircuitElement)(elements.elementAt(i))).getType().compareToIgnoreCase("Ideal Voltage Source")==0) { i_numIdealVoltageSource++; } if(((CircuitElement)(elements.elementAt(i))).getType().compareToIgnoreCase("Real Voltage Source")==0) { i_numRealVoltageSource++; } } i_systemSize=i_numNodes-1; A = new Matrix(i_systemSize, i_systemSize); b = new Matrix(i_systemSize, 1); x = new Matrix(i_systemSize, 1); for (int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.