Reusability

profilejaego
prg_wk4.docx

* 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.

*/

package week4;

import java.awt.Dimension;

import java.awt.FlowLayout;

import java.util.Scanner;

import javax.swing.JFrame;

import javax.swing.JScrollPane;

import javax.swing.JTable;

/**

*

*

* @author Maricela

*/

public class Week4 {

public Week4 () {

}

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

//Show yearly gross pay

int firstNumber = 1;

int scndNumber = 3;

int fixedSalary = 5000;

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 2.45% of all sales made for the year.");

// Calculate the total sum of the salary plus the commission earned plus accelerated rate.

System.out.println("The total of a sales person's earning's for the year is $" + fixedSalary + ", plus an 2.45 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? ");

System.out.println(fixedSalary + " is the yearly gross pay of a sales person.");

// Show the fact that a sales person will also earn 2.45% pay of any sales.

System.out.println("A sales person will also receive an additional 2.45% 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 2.45 percent commission on all sales for that year.");

Scanner keyboard;()

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? ");

}

public void main args(String[] ) { // 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 $700,000. The sales incentive will only start when 80% of the sales target is met.

System.out.println("A sales person will also receive an additional 2.45% 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 + ", 2.45 percent commission starts when 80% of the sales target is met.");

// 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 = 700000;

saleIn = (spResponse) * .245;

System.out.println("The total incentive is $" + saleIn);

// Calculate the total income for the year.

int totalAnualComp = 2.45% + 500000;

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", " 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");

}

}

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 + 2.45 percent if sales reach 80 pecent of 500,000: ");

System.out.println ("");

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

{

}

System.out.println ("");

for (String names2 : name)

{

System.out.println (names2+"");

}