Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Having trouble displaying the values for total sales and compensation.

$
0
0
I am having troubles getting the required output for this program. I am trying to display the total sales in one column and the total compensation in another. The output I have now only displays the keywords "Total Sales" & "Total Compensation". Lines 51 through 53 are the ones I need help on. It is telling me there are five errors such as not a statement and ";" required.

 /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commission.calculation.program;

import java.text.DecimalFormat;
import javax.swing.JOptionPane;

/**
 *
 * @author David
 * 
 * 
 */
   public class CommissionCalculationProgram {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       String input; //Input of user
       double salary; //This is the annual sales value
       double rate; //This is the commission rate
       double commission; //This is the amount of commision made
       double pay; //Salesperson's pay
       double sales; //annual sales
       double incentive = 0; //sales incentive
 
       DecimalFormat dollar = new DecimalFormat("#,##0.00");
       DecimalFormat percent = new DecimalFormat("##0.0%");
       input = JOptionPane.showInputDialog("Enter the annual salary.");
       salary = Double.parseDouble(input);
       input = JOptionPane.showInputDialog("Enter the current commission rate.");
       rate = Double.parseDouble (input);
       input = JOptionPane.showInputDialog("Enter the current sales target.");
       sales = Double.parseDouble (input);
 
       commission = rate * salary;
       pay = commission + salary;
       JOptionPane.showMessageDialog(null, "Commission rate is " +
        percent.format(rate) + ". The amount of pay is $" + dollar.format(pay));
       
       if (sales>=(.80 * sales) && sales<=120000) {
          incentive = (.75 * sales);
       }
          else if (sales >120000) {
          incentive = (1.25 * .75 * sales);
        }
          JOptionPane.showMessageDialog (null, "Total Sales" + "Total Compensation" + "\n"
            "\n" dollar.format(sales) + 5000 +
            "\n"(dollar.format(sales) + dollar.format(incentive) )  );
          
          System.exit(0);
    }   
 
}
 

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>