Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you help me find the error in my code please? You have just started a sales

ID: 3638116 • Letter: C

Question

Can you help me find the error in my code please?

You have just started a sales job in a department store. Your pay consists of a base salary and a commission. The base salary is $5000. The scheme shown below is used to determine the commission rate:

Sales Amount Commission Rate
$0.01 - $5000.00 8 percent
$5000.01 - $10,000.01 10 percent
$10000.01 and above 12 percent

Your goal is to earn $30,000.00 a year. Write a program that finds out the minimum amount of sales you have to generate in order ro make $30,000.00 for the year. Here's what I have so far, and I believe the code is correct, there must be something I'm not doing right because my program won't run!! Please help!!

/* Create a Program to calculate the sales amount need to earn enough commissions to increase your base salary from $5000 per year to $30000 per year.*/

package hw.assignment2.sale.amount;

// Use javax.swing.JoptionPane

import javax.swing.JOptionPane;

public class HWAssignment2SaleAmount {

// This is where the Main method begins
public static void main(String[] args) {

// Commisions needed
final double COMMISSIONS_NEEDED = 30000;

// Declare commissions
double commissions = 0;

// Declare salesAmount
double salesAmount = 1;

//start while loop
while (commissions < COMMISSIONS_NEEDED) {

//Calculate commissions
if (salesAmount >= 10001)

// calculate the commissions if sales are less than 10000
commissions = 5000 * 0.08 + 5000 * 0.10 + (salesAmount - 10000) * 0.12;

else if (salesAmount >= 5001)

// Calculate commissions if sales are greater than 5000
commissions = 5000 * 0.08 + (salesAmount - 5000) * 0.10;
else

// calculate the commissions
commissions = salesAmount * 0.08;

// with increasing salesAmount
salesAmount++;

} //end of while loop

// Display the sales amount

String output = "The sales amount" + salesAmount + " is needed to make a commission of $" + COMMISSIONS_NEEDED;

JOptionPane.showMessageDialog(null, outputs, JOptionPane.INFORMATION_MESSAGE); This is where I get an error message from Netbeans7.1: "Cannot find symbol." "Symbol: variable outputs."

System.exit(0);

} // End the Main method

} // End the class

3 days I've been trying to figure this out!! Thanks community!

Explanation / Answer

please rate - thanks

would you believe, you had an extra s and your missing a field

// Use javax.swing.JoptionPane

import javax.swing.JOptionPane;

public class HWAssignment2SaleAmount {

// This is where the Main method begins
public static void main(String[] args) {

// Commisions needed
final double COMMISSIONS_NEEDED = 30000;

// Declare commissions
double commissions = 0;

// Declare salesAmount
double salesAmount = 1;

//start while loop
while (commissions < COMMISSIONS_NEEDED) {

//Calculate commissions
if (salesAmount >= 10001)

// calculate the commissions if sales are less than 10000
commissions = 5000 * 0.08 + 5000 * 0.10 + (salesAmount - 10000) * 0.12;

else if (salesAmount >= 5001)

// Calculate commissions if sales are greater than 5000
commissions = 5000 * 0.08 + (salesAmount - 5000) * 0.10;
else

// calculate the commissions
commissions = salesAmount * 0.08;

// with increasing salesAmount
salesAmount++;

} //end of while loop

// Display the sales amount

String output = "The sales amount " + salesAmount + " is needed to make a commission of $" + COMMISSIONS_NEEDED;

JOptionPane.showMessageDialog(null, output,"SALES", JOptionPane.INFORMATION_MESSAGE);

System.exit(0);

} // End the Main method

} // End the

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote