I tried dreamincode but the mods there all seem to be on their periods tonight so i have come here to humbly beg for help. First off let me start by saying I'm a new programmer and I am frustrated and cofused by the class i'm in prg 420. I need to pass this assignemn this week or i'll most likely fail this class, I wrote my own code but i am having trouble getting it to run error free i will first post the question and then the code i wrote.



Individual
Write a simple commission calculation program using IDE.




•       The application will now compare the total annual compensation of at least two salespersons.

•       It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners.

•       The application should ask for the name of each salesperson being compared.

•       Use OOP concepts as defined in the previous week program.

The Java™ application should also meet these technical requirements:

•       The application should have at least one class, in addition to the application’s controlling class.
•       The source code must demonstrate the use of Array or ArrayList and store the names, and total sales for each individual in the array or ArrayList data structure..
•       There should be proper documentation in the source code.
•       Include a screen shot of the running program.




import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

/**
* This program will show that a sales person will earn a fixed salary of $55,000.
* It will also show that a sales person will also receive an 14% commission as a sales incentive
* Lastly, a sum of the fixed salary plus the commission earned.
*/
public class CommissionCalculation {

public CommissionCalculation() {
}



/**
*
* @author admin
*/
public class JavaApplication11 {

/**
* @param args the command line arguments
*/
}
public void main (String[] args) {
// Show the yearly gross pay.
int firstNumber = 1;
int secondNumber = 3;
int fixedSalary = 55000;
System.out.println(fixedSalary + " is the yearly gross pay of a sales person.");
// Show the fact that a sales person will also earn 14% pay of any sales.
System.out.println("A sales person will also receive an additional 14% of all sales made for the year.");
// Calculate the total sum of the salary plus the commission earned.
System.out.println("The total of a sales person's earning's for the year is $" + fixedSalary + ", plus an 14 percent commission on all sales for that year.");
// Way of input by keyboard.
Scanner keyboard = new Scanner(System.in);
// Get the sale's person's annual sales.
double salesAmount; //Amount sold for the year
System.out.print("What was your total sales amount? ");
salesAmount = keyboard.nextDouble();
//Example: Sale's Person Response is 200000 in annual sales.

// Calculate the sales incentive earned.
double saleIn; //Total earned ytd.
int spResponse = 300000;
saleIn = (spResponse) *.014;
System.out.println("The total incentive is $" + saleIn);
// Calculate the total income for the year.
int totalAnualComp = 1400 + 55000;
System.out.println("The total annual compensation is $" + totalAnualComp );



}

/**
*A salesperson will continue to earn a fixed salary of $55,000.
*The current sales target for every salesperson is $165,000. The sales incentive will only start when 75% of the sales target is met.
*The current commission is 14% of total sales. If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.8.
*/
public class CommissionCalc
{

/**
*
* @param args
*/

public void main (String[] args) {
// Indicate the yearly gross pay.
int firstNumber = 1;
int secondNumber = 3;
int fixedSalary = 55000;
System.out.println(fixedSalary + " is the yearly gross pay of a sales person.");

// Show the fact that the current sales target for every salesperson is $165,000. The sales incentive will only start when 75% of the sales target is met.
System.out.println("A sales person will also receive an additional 14% of all sales made for the year.");

// Calculate the total sum of the salary plus the commission earned.
System.out.println("The total of a sales person's earning's for the year is $" + fixedSalary + ", 14 percent commission starts when 75% of the sales target is met plus 1.8 percent acceleration factor if a salesperson exceeds the sales target .");
// Way of input by keyboard.
Scanner keyboard = new Scanner(System.in);

// Get the sale's person's annual sales.
double salesAmount; //Amount sold for the year
System.out.print("What was your total sales amount? ");
salesAmount = keyboard.nextDouble();

//Example: Sale's Person Response is 165000 in annual sales.

// Calculate the sales incentive earned.
double saleIn; //Total earned ytd.
int spResponse = 165000;
saleIn = (spResponse) * .14;
System.out.println("The total incentive is $" + saleIn);
// Calculate the total income for the year.
int totalAnualComp = 1400 + 55000;
System.out.println("The total annual compensation is $" + totalAnualComp );



}




public class table extends JFrame {

JTable table;

public table() {
setLayout (new FlowLayout());

String[] columnNames = {"Total Sales", "Total Compensation"};

object[][] data = {
/* {"100,000", "Calculated Value"},
{"105,000", "Calculated Value"},
{"110,000", "Calculated Value"},
{"115,000", "Calculated Value"},
{"120,000", "Calculated Value"},
{"125,000", "Calculated Value"},
{"130,000", "Calculated Value"},
{"135,000", "Calculated Value"},
{"140,000", "Calculated Value"},
{"145,000", "Calculated Value"},
{"150,000", "Calculated Value"},*/
};

table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500, 50));
table.setFillsViewportHeight(true);

JScrollPane scrollpane = new JScrollPane(table);
add(scrollpane);
}

/**
*
* @param args
*/
public void main(String args[]) {
table gui = new table();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(400,200);
gui.setVisible(true);
gui.setTitle("Commission Table");
}
}
}
}

/*import java.util.*;*/

/**
*
* @author admin
*/
public class Salesperson {
public static void main(String[] args) {

int count = 0;
int index = 0;
Scanner scan = new Scanner (System.in);
String prompt = ("Enter the salesperson's names: ");
System.out.print ("This program will ask you to enter your name. Enter the salesperson's names. How many are" + "there");
int amount = scan.nextInt();
String[] name = new String[amount];
String[] secondname = new String[amount];
System.out.print ("You entered" +amount+ "the names of your salespersons.");
System.out.println ("");


for (index = 0; index < amount; index++)
{
System.out.print("Enter next name: ");
name[index] = scan.next();
}

System.out.println ("");
System.out.println ("Then enter salary * commission + 1.8 percent if sales reach 75 pecent of 165,000: ");
System.out.println ("");


for (index = name.length - 1; index >= 0; index--)
{
}

System.out.println ("");

for (String names2 : name)
{
System.out.println (names2+"");
}
}
{
}
} 

Recommended Answers

All 2 Replies

and what exactly is the problem you are having?

looks like he got his arse kicked on another site for dumping his homework assignment so he's now trying here...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.