工资薪酬管理java代码,工资薪酬管理java代码是多少-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

工资薪酬管理java代码,工资薪酬管理java代码是多少

用JAVA编写一个处理学院员工月薪的应用程序的代码是什么?

abstract class Person{

创新互联成立于2013年,是专业互联网技术服务公司,拥有项目网站制作、成都网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元西充做网站,已为上家服务,为西充各地企业和个人服务,联系电话:13518219792

private String name;

private String post;

Person(String name,String post){

this.name = name;

this.post = post;

}

public String getID(){

return (name+""+post);

}

public abstract double counting();

public void setName(String name){

this.name = name;

}

public String getName(){

return this.name;

}

public void setPost(String post){

this.post = post;

}

public String getPost(){

return this.post;

}

}

class Leader extends Person{

Leader(String name,String post){

super(name,post);

}

public double counting(){

return 3000d;

}

}

class Management extends Person{

private double basicWage=0d; //基本工资

private double allowance=0d; //津贴

Management(String name,String post){

super(name,post);

}

public void setBasicWage(double basicWage){

this.basicWage = basicWage;

}

public double getBasicWage(){

return this.basicWage;

}

public void setAllowance(double allowance){

this.allowance = allowance;

}

public double getAllowance(){

return this.allowance;

}

public double counting(){

return this.basicWage+this.allowance;

}

}

class Teacher extends Person{

private int hours; //课时

static final double ASSISTANT_STANDARD = 35.0d;//助教的课时收费标准

static final double LECTOR_STANDARD = 45.0d;//讲师的课时收费标准

static final double ANOTHER_STANDARD = 55.0d;//其他课时收费标准

Teacher (String name,String post){

super(name,post);

}

public double counting(){

double wage; //工资

if(this.getPost().equals("助教")){

wage = ASSISTANT_STANDARD*hours;

}else if(this.getPost().equals("讲师")){

wage = LECTOR_STANDARD * hours;

}else{

wage = ANOTHER_STANDARD * hours;

}

return wage;

}

public void setHours(int hours){

this.hours = hours;

}

public int getHours(){

return this.hours;

}

}

class Test {

public static void main(String [] args){

Leader leader = new Leader("张三","领导");

System.out.println(leader.getName()+"工资为:"+leader.counting());

Management manage = new Management("李四","管理人员");

manage.setBasicWage(1000d);

manage.setAllowance(500d);

System.out.println(manage.getName()+"工资为:"+manage.counting());

Teacher teacher = new Teacher("王五","助教");

teacher.setHours(50);

System.out.println(teacher.getName()+"工资为:"+teacher.counting());

Teacher teacher1 = new Teacher("赵六","讲师");

teacher1.setHours(60);

System.out.println(teacher1.getName()+"工资为:"+teacher1.counting

());

}

}

看下吧,有什么不足的请指出来

java计算工资

person类:

public abstract class Person {

public double pay; // 总工资

public int hour; // 课时

public double countPay(int hour) {

return pay;

}

}

助教类:

public class Assistant extends Person {

public final double BASE_PAY = 800; // 基本工资

public final double HOUR_PAY = 25; // 每课时的费用

public double countPay(int hour) {

pay = BASE_PAY + hour * HOUR_PAY;

return pay;

}

}

讲师类:

public class Instructor extends Person {

public final double BASE_PAY = 1000; // 基本工资

public final double HOUR_PAY = 35; // 每课时的费用

public double countPay(int hour) {

pay = BASE_PAY + hour * HOUR_PAY;

return pay;

}

}

副教授类:

public class AssistantProfesson extends Person {

public final double BASE_PAY = 1200; // 基本工资

public final double HOUR_PAY = 40; // 每课时的费用

public double countPay(int hour) {

pay = BASE_PAY + hour * HOUR_PAY;

return pay;

}

}

教授类:

public class Professor extends Person {

public final double BASE_PAY = 1400; // 基本工资

public final double HOUR_PAY = 50; // 每课时的费用

public double countPay(int hour) {

pay = BASE_PAY + hour * HOUR_PAY;

return pay;

}

}

测试类:

import java.io.BufferedReader;

import java.io.InputStreamReader;

public class Test {

public static void main(String[] args) {

System.out.println("人员类型如下:");

System.out.println("1 = 助教\r\n2 = 讲师\r\n3 = 副教授\r\n4 = 教授");

System.out.print("请选择:");

BufferedReader personType = new BufferedReader(new InputStreamReader(

System.in));

String type = null;

int hour = 0;

try {

type = personType.readLine();

} catch (Exception e) {

e.printStackTrace();

}

if (type.matches("[1-4]{1}")) {

switch (Integer.valueOf(type)) {

case 1:

hour = getHour();

if(hour == 0){return;}

Person p1 = new Assistant();

double pay1 = p1.countPay(hour);

System.out.println("助教工作" + hour + "课时的工资为:" + pay1);

break;

case 2:

hour = getHour();

if(hour == 0){return;}

Person p2 = new Instructor();

double pay2 = p2.countPay(hour);

System.out.println("讲师工作" + hour + "课时的工资为:" + pay2);

break;

case 3:

hour = getHour();

if(hour == 0){return;}

Person p3 = new AssistantProfesson();

double pay3 = p3.countPay(hour);

System.out.println("副教授工作" + hour + "课时的工资为:" + pay3);

break;

case 4:

hour = getHour();

if(hour == 0){return;}

Person p4 = new Professor();

double pay4 = p4.countPay(hour);

System.out.println("教授工作" + hour + "课时的工资为:" + pay4);

break;

}

} else {

System.out.println("输入数据错误!程序提前推出!");

return;

}

}

public static int getHour() {

System.out.print("请输入工作时间:");

BufferedReader hours = new BufferedReader(new InputStreamReader(

System.in));

String strHour = null;

int hour = 0;

try {

strHour = hours.readLine();

} catch (Exception e) {

e.printStackTrace();

}

if (strHour.matches("^[0-9]+?")) {

hour = Integer.parseInt(strHour);

} else {

System.out.println("输入参数不正确!程序提前推出!");

}

return hour;

}

}

使用java编写程序实现输入员工工资,获得员工的平均工资,要求使用象数组类型的

一:将员工姓名、工资封装成一个对象

public class Staff {

private String name;

private int salary;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getSalary() {

return salary;

}

public void setSalary(int salary) {

this.salary = salary;

}

public Staff(String name, int salary) {

super();

this.name = name;

this.salary = salary;

}

}

二:初始化一个数组,算平均工资

public class Average {

public static void main(String[] args) {

Staff staffs[] = {new Staff("zhangsan", 1000), new Staff("lisi", 1100), new Staff("wangwu", 1200)};

int sum = 0;

for(Staff staff : staffs) {

sum = sum + staff.getSalary();

}

System.out.println("员工人数:" + staffs.length + " 总工资:" + sum + " 平均工资:" + sum / staffs.length);

}

}

JAVA编写一个为员工加薪的类(类与对象)

class Employee {

private String name;

private String department;

private double salary;

//构造方法

public Employee(String name, String department, double salary) {

this.name = name;

this.department = department;

this.salary = salary;

}

public String toString() {

return "姓名:" + name + "\t部门:" + department + "\t工资:" + salary;

}

public void raiseSalary(double per) {

this.salary = salary + salary * per;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getDepartment() {

return department;

}

public void setDepartment(String department) {

this.department = department;

}

public double getSalary() {

return salary;

}

public void setSalary(double salary) {

this.salary = salary;

}

}

public class TestEmployee {//测试类

public static void main(String[] args) {

Employee e1 = new Employee("张三", "技术开发部", 5000);

Employee e2 = new Employee("赵四", "后勤服务部", 3800);

Employee e3 = new Employee("王五", "产品营销部", 6800);

System.out.println(e1 + "\n" + e2 + "\n" + e3);

double per = 0.07;

e1.raiseSalary(per);

e2.raiseSalary(per);

e3.raiseSalary(per);

System.out.println("==============加薪7%===============");

System.out.println(e1 + "\n" + e2 + "\n" + e3);

}

}

输出

姓名:张三 部门:技术开发部 工资:5000.0

姓名:赵四 部门:后勤服务部 工资:3800.0

姓名:王五 部门:产品营销部 工资:6800.0

==============加薪7%===============

姓名:张三 部门:技术开发部 工资:5350.0

姓名:赵四 部门:后勤服务部 工资:4066.0

姓名:王五 部门:产品营销部 工资:7276.0


网站题目:工资薪酬管理java代码,工资薪酬管理java代码是多少
文章地址:http://kswsj.cn/article/dssshgc.html

其他资讯