// 改代码为片段,全文五百行左右,也支持定做其他系统,该系统无框架(也支持定做有框架的系统)
// QQ: 3233963554(有偿,包解决问题)
package com;
import java.io.*;
import java.util.Scanner;
public class Main {
static employee[] empAll = new employee[1000];
static int flag = 0;
public static void main(String[] args){
while (true){
System.out.println("职工系统");
System.out.println("1---输入功能");
System.out.println("2---查询功能");
System.out.println("3---排序功能");
System.out.println("4---修改功能");
System.out.println("5---删除功能");
System.out.println("6---退出系统");
System.out.println("7---重置后台");
System.out.println("8---工资统计");
System.out.println("请输入您的选择");
int choice = 0;
Scanner scanner = new Scanner(System.in);
choice = scanner.nextInt();
if(choice == 1){
readold();
InPut();
toWrite();
System.out.println("录入完毕");
}
if(choice == 2){
readold();
System.out.println("1--姓名查询");
System.out.println("2---科室查询");
int c = 0;
c=scanner.nextInt();
if(c==1){
search_1();
}
if (c==2){
search_2();
}
}
if(choice == 3){
readold();
sort();
}
if(choice == 4){
readold();
change();
toWrite();
}
if (choice == 5){
readold();
del();
toWrite();
}
if(choice == 6){
break;
}
if(choice == 7){
clearAll();
}
if(choice == 8){
readold();
tJall();
}
}
}
public static void tJall(){
int[] index = new int[1000];
String result = null;
String[] ALLkwhere = new String[1000];
int i = 0;
for(;i<flag;i++){
ALLkwhere[i] = empAll[i].getkWhere();
}
Scanner scanner = new Scanner(System.in);
System.out.println("欢迎使用统计功能");
System.out.println("请输入要统计的科室");
String ck = scanner.next();
i = 0;
int j = 0;
for(i=0;i<flag;i++){
if(ALLkwhere[i].equals(ck)){
index[j] = i;
j++;
}
}
System.out.println("科室的工资如下:");
int k =0;
for(;k<j;k++){
System.out.println(empAll[index[k]].getMoney().toString());
}
System.out.println("该科室的平均工资是");
int x = 0;
int All = 0;
for(;x<j;x++){
int y = Integer.parseInt(empAll[index[x]].getMoney());
All+=y;
}
All/=j;
System.out.println(All);
}
public static void clearAll(){
File file = new File("z.txt");
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
fileWriter.write("");
} catch (IOException e) {
throw new RuntimeException(e);
}
Java教职员工工资管理系统(Java课设)
最新推荐文章于 2024-01-04 14:21:23 发布