Java教职员工工资管理系统(Java课设)

// 改代码为片段,全文五百行左右,也支持定做其他系统,该系统无框架(也支持定做有框架的系统)
// 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);
     
}

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

五弦奏南风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值