重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

公司雇员java代码 用java设计雇员employee

急求;java编程定义一个雇员类

/*java编程定义一个雇员类

创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站制作、做网站、房县网络推广、小程序定制开发、房县网络营销、房县企业策划、房县品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供房县建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com

属性有姓名,工号,方法有获取,设置属性的方法.要求雇员工号统一从1开始

类中必须有2个或以上的构造方法;说明属性和方法前的修饰符 */

public class Wk {

public int id; //工号

public String name;

public int getid(){return (id);};//获取工号

public String getname(){return name;}//获取姓名

public void setid(int id0){id=id0;}//设置工号

public void setname(String name0 ){name=name0;}//设置姓名

public Wk(){ //构造函数1,无参

id=1;name=" ";

}

public Wk(String name0){ //构造函数2,1参数

id=1;name=name0;

}

public Wk(int id0, String name0){ //构造函数3,2参数

id=id0;

name=name0;

}

}

java编程 定义一个类描述公司雇员

public class Employee {

private int id;

private String name;

private double salary;

public Employee() {

this.id = 0;

this.name = null;

this.salary = 0.0;

}

public Employee(int id, String name, double salary) {

super();

this.id = id;

this.name = name;

this.salary = salary;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public double getSalary() {

return salary;

}

public void setSalary(double salary) {

this.salary = salary;

}

}

JAVA编程,计算公司不同员工工资。

JAVA计算工人工资,参考例子如下:

import java.util.Scanner;

public class Demo00 {

//定义一个三维数组,用于记录每个部门、分支、绩效工资

private static final float[][][] SALARY_OF_PER_HOUR = {

{{10.75f,12.50f,14.50f},{11.75f,14.50f,17.50f}},

{{13.00f,16.00f,18.50f},{15.00f,18.50f,22.00f}},

{{16.75f,18.50f,20.50f},{19.25f,25.00f,30.00f}}

};

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

//输入姓名

System.out.println("请输入姓名:");

String name = sc.nextLine();

//输入部门并验证

System.out.println("请输入部门: A,B,C");

char dept = sc.nextLine().charAt(0);

if(dept'A'||dept'C')

{

System.out.println("输入有误,系统将退出");

System.exit(0);

}

//输入分支机构并验证

System.out.println("请输入分支机构: 1,2");

char div = sc.nextLine().charAt(0);

if(div'1'||div'2')

{

System.out.println("输入有误,系统将退出");

System.exit(0);

}

//输入薪绩表并验证

System.out.println("请输入薪绩表: a,b,c");

char sal = sc.nextLine().charAt(0);

if(sal'a'||sal'c')

{

System.out.println("输入有误,系统将退出");

System.exit(0);

}

//输入小时数

System.out.println("请输入本周工作时间(整小时数):");

int hours = sc.nextInt();

float salary = 0;

//每个小时的薪水

float salaryPerHour = SALARY_OF_PER_HOUR[dept-'A'][div-'1'][sal-'a'];

//分别计算40小时内和超过40小时的薪水

if(hours=40)

{

salary += salaryPerHour*hours;

}

else

{

salary += salaryPerHour*hours+(hours-40)*1.5*salaryPerHour;

}

//输出结果

System.out.println("姓名:\t"+name+"\n部门:\t"+dept+"\n分支机构:\t"+div

+"\n薪绩表:\t"+sal+"\n工作时间:\t"+hours+"\n薪水:\t"+salary);

}

}

//Best wishes!

用java编写一个程序:某个公司有3不同的雇员,分为A、B、C3个级别。。

package com.lgy.question;

public abstract class Employee {

public abstract double pay();

}

package com.lgy.question;

/**

* @author LONGGUOYOU

*

* A类员工工资 APAY 变动就改2000.00处

*

*/

public class AgradeEmployee extends Employee {

private static final double APAY = 2000.00;

private int peopleANumber;

public AgradeEmployee(int numbers) {

// TODO Auto-generated constructor stub

this.peopleANumber = numbers;

}

@Override

public double pay() {

// TODO Auto-generated method stub

return APAY * peopleANumber;

}

}

package com.lgy.question;

/**

* @author LONGGUOYOU

*

* B类员工工资 BPAY 变动就改1000.00处

*

*/

public class BgradeEmployee extends Employee {

private static final double BPAY = 1000.00;

private int peopleBNumber;

public BgradeEmployee(int numbers) {

// TODO Auto-generated constructor stub

this.peopleBNumber = numbers;

}

@Override

public double pay() {

// TODO Auto-generated method stub

return BPAY * peopleBNumber;

}

}

package com.lgy.question;

/**

* @author LONGGUOYOU

*

* C类员工工资 CPAY 变动就改2200.00处

*

*/

public class CgradeEmployee extends Employee {

private static final double CPAY = 2200.00;

private int peopleCNumber;

public CgradeEmployee(int numbers) {

// TODO Auto-generated constructor stub

this.peopleCNumber = numbers;

}

@Override

public double pay() {

// TODO Auto-generated method stub

return CPAY * peopleCNumber;

}

}

package com.lgy.question;

import javax.swing.JOptionPane;

/**

*

* @author LONGGUOYOU

*

* /

public class Company {

/**

* 声明总工资

*/

public static double sumPay;

/**

* 求总共需要支付的工资

*/

public void sumPay(){

/**

* 以下是接受每个月人数的变动

*/

String anumbers = JOptionPane.showInputDialog("请输入A类员工人数:");

int Anumbers = Integer.parseInt(anumbers);

String bnumbers = JOptionPane.showInputDialog("请输入B类员工人数:");

int Bnumbers = Integer.parseInt(bnumbers);

String cnumbers = JOptionPane.showInputDialog("请输入C类员工人数:");

int Cnumbers = Integer.parseInt(cnumbers);

//将AgradeEmployee,BgradeEmployee,CgradeEmployee放进数组

final Employee[] employees = { new AgradeEmployee(Anumbers),

new BgradeEmployee(Bnumbers), new CgradeEmployee(Cnumbers) };

for (int i = 0; i employees.length; i++) {

sumPay += employees[i].pay();

}

//对话框给出

JOptionPane.showMessageDialog(null,"总共需要支付工资:" + sumPay);

//控制台打印出来

System.out.println("总共需要支付工资:" + sumPay);

}

public static void main(String[] args) {

new Company().sumPay();

}

}

本人菜鸟一个,只供参考,大虾们请多多指教!


当前题目:公司雇员java代码 用java设计雇员employee
网页地址:http://cqcxhl.com/article/dojooie.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP