工资管理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编写一个关于工资管理系统的程序?具体功能如下:
工资管理系统主要功能和特点:
1 操作简单方便
采用国际流行的下拉菜单,全WINDOWS操作形式,界面新颖,全面支持鼠标操作,功能齐全。
2 任意设定工资项目
系统除姓名、人员编号、部门编号、部门名称、应发工资、实发工资、纳税等内定项目不能删除(长度可以改变)外,其它项目(如各种补贴及各种扣款)均可由用户自行定义(包括增加、删除、修改长度及小数位等),工资项目总数可多达255项。当修改或删除工资项目时,自动检查工资计算中与该项目有关的计算公式,并作相应处理。
3 任意定义工资计算公式
用户可将某些工资项目(如加班费、应发工资、纳税等)定义为计算项目,然后定义其计算公式及使用条件,可满足各种复杂的计算。
如: 项目 公式 条件
每日工资 基本工资/26
月加班费 加班天数*每日工资 类别=
求一段简单的JAVA代码 要求员工工资管理系统的一个增删改查代码,谢谢了
对数据库进行增删改查?
以下是 sql server 2013+java.实现的是对MSC对象的增删改查.
需要下载连接驱动程序:com.microsoft.sqlserver.jdbc.SQLServerDriver
网上搜一下就行
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
class MSC
{
public String MscID;
public String MscName;
public String MscCompany;
public float MscLongitude;
public float MscLatitude;
public float MscAltitude;
public MSC(String MscID, String MscName, String MscCompany,
float MscLongitude, float MscLatitude,float MscAltitude){
this.MscID = MscID;
this.MscName = MscName;
this.MscCompany = MscCompany;
this.MscLongitude =MscLongitude;
this.MscLatitude = MscLatitude;
this.MscAltitude = MscAltitude;
}
}
public class sqlserverjdbc {
public Connection getConnection(){
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC驱动
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=gsm"; //连接服务器和数据库sample
String userName = "sa"; //默认用户名
String userPwd = "123"; //密码
Connection dbConn = null;
try {
Class.forName(driverName);
dbConn =DriverManager.getConnection(dbURL, userName, userPwd);
} catch (Exception e) {
e.printStackTrace();
}
return dbConn;
}
public void printUserInfo(){
Connection con = getConnection();
Statement sta = null;
ResultSet rs = null;
System.out.println("打印表格MSC信息");
try {
sta = con.createStatement();
rs = sta.executeQuery("select * from MSC信息");
System.out.println("MscID\tMscName\tMscCompany\tMscLongitude\tMscLatitude\tMscAltitude");
while(rs.next()){
System.out.println(rs.getString("MscID")+"\t"+
rs.getString("MscName")+"\t"+
rs.getString("MscCompany")+"\t"+
rs.getFloat("MscLongitude")+"\t"+
rs.getFloat("MscLatitude")+"\t"+
rs.getFloat("MscAltitude"));
}
con.close();
sta.close();
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("打印完成\n");
}
public void delete(String MscID){
Connection con = getConnection();
String sql = "delete from MSC信息 where MscID = " + MscID;
PreparedStatement pst;
System.out.println("删除表格MSC信息中 ID = "+MscID+"的记录");
try {
pst = con.prepareStatement(sql);
pst.execute();
pst.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("记录删除失败!!!");
}
System.out.println("记录删除成功!!!\n");
}
public void insert(MSC msc){
Connection con = getConnection();
String sql = "insert into MSC信息 values(?,?,?,?,?,?)";
PreparedStatement pst;
System.out.println("插入一条记录");
try {
pst = con.prepareStatement(sql);
pst.setString(1, msc.MscID);
pst.setString(2, msc.MscName);
pst.setString(3, msc.MscCompany);
pst.setFloat(4, msc.MscLongitude);
pst.setFloat(5, msc.MscLatitude);
pst.setFloat(6, msc.MscAltitude);
pst.execute();
pst.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("插入失败!!!");
}
System.out.println("插入成功!!!\n");
}
//更新MscID的MscName
public void updateMscName(String MscID, String MscName){
Connection con = getConnection();
String sql = "update MSC信息 set MscName = ? where MscID = ?";
PreparedStatement pst;
System.out.println("修改一条记录");
try {
pst = con.prepareStatement(sql);
pst.setString(1, MscName);
pst.setString(2, MscID);
pst.execute();
pst.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("修改失败!!!");
}
System.out.println("修改成功!!!\n");
}
public static void main(String args[]){
sqlserverjdbc sql = new sqlserverjdbc();
sql.printUserInfo();
sql.delete("1111");
sql.printUserInfo();
sql.updateMscName("5215", "联想");
sql.printUserInfo();
sql.insert(new MSC("1111", "中兴" ," 中兴", (float)12.2, (float)3.4,(float)45.5));
sql.printUserInfo();
}
}
本文题目:工资管理java代码 薪酬管理的代码
文章分享:http://pwwzsj.com/article/hjsgso.html