⑴ java老師布置了個作業 寫一個員工管理員系統 ,員工能夠登錄系統 查詢
這是最簡單的了.
就一個類 , 用戶類 User
六個屬性 : id , 姓名 , 年齡 , 手機 , 生日 , 許可權
普通用戶的許可權值比如給個 normal , 管理員給個 admin
這就可以了 . 每次登陸時候判斷許可權是 normal 還是 admin
是admin就把其他用戶列出來顯示 , 隨便修改 .
如果是 normal , 就只顯示當前登陸用戶的信息 , 讓他只能改自己的就是了 .
如果需要幫你畫類圖或者需要代碼 , 可以私信我 .
滿意請採納 , 謝謝
⑵ JAVA員工管理小程序
Employee類:
public class Employee {
private int id;
private String name;
private int age;
private String email;
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 int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
Manager類:
import java.util.ArrayList;
import java.util.List;
public class Manager {
public static List<Employee> employees = new ArrayList<Employee>();
public static void addEmployee(Employee employee){
employees.add(employee);
}
public static void deleteEmployee(Employee employee){
employees.remove(employee);
}
public static void updateEmployee(Employee employee){
int len = employees.size();
for(int i=0;i<len;i++){
Employee e = employees.get(i);
if(e.getId() == employee.getId()){
deleteEmployee(e);
addEmployee(employee);
}
}
}
public static Employee selectEmployeeById(int id){
int len = employees.size();
if(len!=0){
Employee emp = new Employee();
for(int i=0;i<len;i++){
Employee e = employees.get(i);
if(e.getId() == id){
emp = e;
}
}
return emp;
}else{
return null;
}
}
public static Employee selectEmployeeByName(String name){
int len = employees.size();
if(len!=0){
Employee emp = new Employee();
for(int i=0;i<len;i++){
Employee e = employees.get(i);
if(e.getName().equals(name)){
emp = e;
}
}
return emp;
}else{
return null;
}
}
public static void printEmployees(){
int len = employees.size();
if(len != 0){
for(int i=0;i<len;i++){
System.out.println(employees.get(i).getId()+":\t"+
employees.get(i).getName()+"\t"+
employees.get(i).getAge()+"\t"+
employees.get(i).getEmail());
}
}else{
System.out.println("無員工");
}
}
}
測試EmpManaTest類:
public class EmpManaTest {
public static void main(String[] args) {
Employee e = new Employee();
e.setId(1);
e.setName("zz");
e.setAge(20);
e.setEmail("[email protected]");
Manager.addEmployee(e);
Employee e2 = new Employee();
e2.setId(2);
e2.setName("scof");
e2.setAge(18);
e2.setEmail("[email protected]");
Manager.addEmployee(e2);
System.out.println("添加員工後:");
Manager.printEmployees();
System.out.println("----------------------------------------------");
Employee emp = new Employee();
emp.setId(1);
emp.setName("virus");
emp.setAge(30);
emp.setEmail("[email protected]");
Manager.updateEmployee(emp);
System.out.println("修改員工後:");
Manager.printEmployees();
System.out.println("----------------------------------------------");
System.out.println("查詢員工ByID:");
Employee empSelectId = Manager.selectEmployeeById(1);
System.out.println(empSelectId.getName());
System.out.println("----------------------------------------------");
System.out.println("查詢員工ByName:");
Employee empSelectName = Manager.selectEmployeeByName("virus");
System.out.println(empSelectName.getEmail());
System.out.println("----------------------------------------------");
System.out.println("刪除一個員工後:");
Manager.deleteEmployee(emp);
Manager.printEmployees();
}
}
這個是不是你想要的...........
⑶ 用java數據結構編寫一個簡單的職工管理系統 急求高手進。。。。
import java.util.Scanner;
import java.util.Stack;
public class TestNumTran {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("請輸入需要轉換的數字:");
int num = scan.nextInt();
int ocNum = num;
Stack stack = new Stack();
int flag = 0;
while(num != 0) {
flag = num%2;
if(flag == 0 ) {
stack.push(0);
} else {
stack.push(1);
}
num = num/2;
}
System.out.print(ocNum + "轉換成二進制為:");
while(!stack.empty()) {
System.out.print(stack.peek());
stack.pop();
}
}
}
書的下載地址:
另外,虛機團上產品團購,超級便宜
⑷ 用java介面如何實現員工信息管理,不需要代碼,把程序的框架講一下就行
員工信息嘛,無非就是增刪改查四類操作
定義個員工類,假設Employee
然後定義個介面,這個介面主要有4個方法,即增刪改查
public interface EmployeeInterface{
Employee save(Employee employee);
boolean delete(Employee employee);
List query(Employee employee);
Employee update(Employee employee);
}
//保存為EmployeeInterface.java,這是介面
public class EmployeeInterfaceImpl implements EmployeeInterface{
public Employee save(Employee employee){
//這里就是你操作資料庫了
System.out.println("數據保存了");
return null;
}
public boolean delete(Employee employee){
//這里就是你操作資料庫了
System.out.println("數據刪除了");
return false;
}
public List query(Employee employee){
//這里就是你操作資料庫了
System.out.println("數據查詢了");
return null;
}
public Employee update(Employee employee){
//這里就是你操作資料庫了
System.out.println("數據更新了");
return null;
}
}
//保存為EmployeeInterfaceImpl.java,這是實現類
public class Employee{
//自己定義一些欄位
}
//保存為Employee.java
List需要導入包
import java.util.List;
⑸ 用JAVA怎麼編寫HR(部門員工管理系統) 要源代碼
如果純用Java的話,最好採用Swing,這樣利於用戶交互,但是現在估計沒有誰有那個源代碼的了,lz還是自己努力一下,親手實踐才是自己的……
⑹ 求一段簡單的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設計 - 企業員工工資管理系統的源代碼和運行效果截圖
作為一個學生,需要增強自己的動手能力哦,不然這樣的設計會變得毫無用處。下面這個可以學習下
網頁鏈接
⑻ Java公司員工管理系統
java 寫的公司員工管理系統
員工信息管理 職位管理 工資管理
java web開發
資料庫:mysql
開發工具:myeclipse or eclipse
伺服器:tomcat
⑼ Java人事管理系統代碼和資料庫
你要連的資料庫是SQL 還是ORACLE
但是代碼都查不多
下面的是連接SQL資料庫的代碼
你需要先創建個資料庫,還有表,表的欄位是登陸名和密碼
下面的"SA" 是登陸名 "111111" 是密碼
ORACLE 和這個查不多
import java.sql.*;//做資料庫時候必須要引入的包
import com.microsoft.jdbc.sqlserver.SQLServerDriver;
public class DBFactory {
Connection Conn=null;
PreparedStatement Stmt=null;
ResultSet Rs=null;
String driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String OracleUserName="sa";
String OracleUserPwd="111111";
String ConnUrl="jdbc:sqlserver://localhost:1433;databaseName=news";
public Connection getConnection()
{
try {
Class.forName(driverName);
} catch (ClassNotFoundException ex) {
System.out.println("載入驅動程序有錯誤");
}
try {
Conn = DriverManager.getConnection(ConnUrl, OracleUserName,OracleUserPwd);
} catch (SQLException ex1) {
System.out.print("取得連接的時候有錯誤,請核對用戶名和密碼");
}
return Conn;
}
這個是連接ORACLE資料庫代碼
import java.sql.*;
import oracle.jdbc.driver.OracleDriver;
public class DBFactory {
Connection Conn=null;
PreparedStatement Stmt=null;
ResultSet Rs=null;
String driverName="oracle.jdbc.driver.OracleDriver";
String OracleUserName="scott";
String OracleUserPwd="tiger";
String ConnUr1="jdbc:oracle:thin:@locahost:1521:Ora";
public Connection getConnection()
{
try {
Class.forName(driverName);
} catch (ClassNotFoundException ex) {
System.out.println("載入驅動程序有錯誤");
}
try {
Conn = DriverManager.getConnection(ConnUr1, OracleUserName,OracleUserPwd);
} catch (SQLException ex1) {
System.out.print("取得連接時有錯誤,請核對用戶名和密碼");
}
return Conn;
}
希望能追加分數謝謝!