使用Java语言编写程序,输出某公司员工的基本信息

使用Java语言编写程序,输出某公司员工的基本信息,第1张

public class Test0 {

public static void main(String[] args) {

Employee ZhangSan = new Employee("001", "张三", '男', "销售部", 6000, 1000, "普通员工");

Employee LiSi = new Employee("002", "李四", '女', "人事部", 7000, 2000, "超级员工");

Systemoutprintln(ZhangSantoString()); //打印张三信息

Systemoutprintln(LiSitoString()); //打印李四信息

}

}

class Employee{

private String id; //员工ID

private String name; //姓名

private char sex; //性别

private String department; //部门

private int basic_salary; //基本工资

private int extra_salary; //薪金

private String classify; //类别

/

构造方法

/

public Employee(String id, String name, char sex, String department,

int basic_salary, int extra_salary, String classify) {

thisid = id;

thisname = name;

thissex = sex;

thisdepartment = department;

thisbasic_salary = basic_salary;

thisextra_salary = extra_salary;

thisclassify = classify;

}

public Employee(){

}

public String getId() {

return id;

}

public void setId(String id) {

thisid = id;

}

public String getName() {

return name;

}

public void setName(String name) {

thisname = name;

}

public char getSex() {

return sex;

}

public void setSex(char sex) {

thissex = sex;

}

public String getDepartment() {

return department;

}

public void setDepartment(String department) {

thisdepartment = department;

}

public int getBasic_salary() {

return basic_salary;

}

public void setBasic_salary(int basic_salary) {

thisbasic_salary = basic_salary;

}

public int getExtra_salary() {

return extra_salary;

}

public void setExtra_salary(int extra_salary) {

thisextra_salary = extra_salary;

}

public String getClassify() {

return classify;

}

public void setClassify(String classify) {

thisclassify = classify;

}

public String toString(){

String str ="[员工ID:"+id+"|姓名:"+name+"|性别:"+sex+

"|部门:"+department+"|基本工资:+"+basic_salary+

"|薪金:"+extra_salary+"|类别:"+classify+"]";

return str;

}

}

public class $ {

    public static void main(String[] args) {

        Employee e = new Employee("1", "aaa", 100);

        eout();

        ein(100, 50);

        eout();

        eselect();

    }

}

class Employee {

    private String no;

    private String name;

    private double salary;

    private double bonus;

    public Employee(String no, String name, double salary) {

        thisno = no;

        thisname = name;

        thissalary = salary;

    }

    public Employee(String no, String name, double salary, double bonus) {

        thisno = no;

        thisname = name;

        thissalary = salary;

        thisbonus = bonus;

    }

    public String getNo() {

        return no;

    }

    public void setNo(String no) {

        thisno = no;

    }

    public String getName() {

        return name;

    }

    public void setName(String name) {

        thisname = name;

    }

    public double getSalary() {

        return salary;

    }

    public void setSalary(double salary) {

        thissalary = salary;

    }

    public double getBonus() {

        return bonus;

    }

    public void setBonus(double bonus) {

        thisbonus = bonus;

    }

    public void out() {

        Systemoutprintln(no + "," + name + "," + salary + "," + bonus);

    }

    public void in(double salary, double bonus) {

        thissalary = salary;

        thisbonus = bonus;

    }

    public void select() {

        Systemoutprintln(salary + bonus);

    }

}

貌似这么大的系统很难有人帮你做,这儿有个学生管理系统,稍加修改就成了~

/学生成绩管理系统/

/系统版本号:2006build 4000201b/

/内核:adobo/

#include <iostreamh>

#include <stringh>

#include <stdlibh>

#include <conioh>

#define N 32

int total=N; //定义全局变量,学生的总个数total

struct student

{

int xh;

char xm[6];

int yw;

int sx;

int yy;

int jsj;

int zf;

};

struct student stu[N],temp;

char get_key() //得到用户按键值

{

char key;

while (1)

{

if (kbhit())

{

key=getch();

break;

}

}

return key;

}

void wait() //按键等待,相当于PAUSE的功能

{

char key;

while (1)

{

if (kbhit())

{

key=getche();

break;

}

}

}

int id_search(int num) //查询该学号学生的数组编号

{

int i;

for (i=0;i<total;i++)

if (stu[i]xh==num) break;

return i;

}

void show_one(int id) //显示某学号学生的信息

{

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"⑴学号:"<<stu[id]xh<<endl;

cout<<"⑵姓名:"<<stu[id]xm<<endl;

cout<<"⑶语文:"<<stu[id]yw<<endl;

cout<<"⑷数学:"<<stu[id]sx<<endl;

cout<<"⑸英语:"<<stu[id]yy<<endl;

cout<<"⑹计算机:"<<stu[id]jsj<<endl;

cout<<"⑺总分:"<<stu[id]zf<<endl;

cout<<"--------------------------------------------------------------"<<endl;

}

void show_all() //显示所有学生的信息

{

int i;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"学号\t"<<"姓名\t"<<"语文\t"<<"数学\t"<<"英语\t"<<"计算机\t"<<"总分"<<endl;

for (i=0;i<total;i++)

cout<<stu[i]xh<<'\t'<<stu[i]xm<<'\t'<<stu[i]yw<<'\t'<<stu[i]sx<<'\t'<<stu[i]yy<<'\t'<<stu[i]jsj<<'\t'<<stu[i]zf<<endl;

cout<<"--------------------------------------------------------------"<<endl;

}

void cj_input() //输入学生的成绩

{

int i;

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"※学生成绩信息录入菜单※"<<endl;

cout<<"◎请完整输入学生个人信息"<<endl;

cout<<"◎学号项键入0可结束编辑"<<endl;

cout<<"--------------------------------------------------------------"<<endl;

for (i=0;i<N;i++)

{

cout<<"请输入第"<<i+1<<"个学生的学号:";

cin>>stu[i]xh;

if (stu[i]xh==0) return; //用户输入0时,结束编辑

cout<<"请输入第"<<i+1<<"个学生的姓名:";

cin>>stu[i]xm;

cout<<"请输入第"<<i+1<<"个学生的语文成绩:";

cin>>stu[i]yw;

cout<<"请输入第"<<i+1<<"个学生的数学成绩:";

cin>>stu[i]sx;

cout<<"请输入第"<<i+1<<"个学生的英语成绩:";

cin>>stu[i]yy;

cout<<"请输入第"<<i+1<<"个学生的计算机成绩:";

cin>>stu[i]jsj;

stu[i]zf=stu[i]yw+stu[i]sx+stu[i]yy+stu[i]jsj;

cout<<"---------------提示:学号项键入 0可结束编辑----------------"<<endl;

}

}

void auto_input() //自动输入学生的成绩,为测试方便而设

{

int i;

for (i=0;i<N;i++)

{

stu[i]xh=(i+1);

strcpy(stu[i]xm,"ayc");

stu[i]yw=rand()%100;

stu[i]sx=rand()%100;

stu[i]yy=rand()%100;

stu[i]jsj=rand()%100;

stu[i]zf=stu[i]yw+stu[i]sx+stu[i]yy+stu[i]jsj;

}

}

void cj_modify() //学生成绩的修改

{

int num,id;

char choice;

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"※学生成绩信息修改菜单※"<<endl;

cout<<"◎请确认已经录入学生信息"<<endl;

cout<<"◎学号不存在即会返回菜单"<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"请输入待修改的学生的学号:";

cin>>num;

id=id_search(num);

if (id==total)

{

cout<<endl;

cout<<"-〖系统提示〗------------------------"<<endl;

cout<<" 错误!无该学号学生信息!"<<endl;

cout<<"-------------------------------------"<<endl;

wait();

return;

}

cout<<"选择要修改的项目的编号,其它值返回:";

show_one(id);

choice=get_key();

if (choice=='1')

{cout<<"输入新的学号:";

cin>>stu[id]xh;

}

else if (choice=='2')

{cout<<"输入新的姓名:";

cin>>stu[id]xm;

}

else if (choice=='3')

{cout<<"输入新的语文成绩:";

cin>>stu[id]yw;

}

else if (choice=='4')

{cout<<"输入新的数学成绩:";

cin>>stu[id]sx;

}

else if (choice=='5')

{cout<<"输入新的英语成绩:";

cin>>stu[id]yy;

}

else if (choice=='6')

{

cout<<"输入新的计算机成绩:";

cin>>stu[id]jsj;

}

stu[id]zf=stu[id]yw+stu[id]sx+stu[id]yy+stu[id]jsj;

if (choice=='1'||choice=='2'||choice=='3'||choice=='4'||choice=='5'||choice=='6')

{

cout<<"-〖系统提示〗------------------------"<<endl;

cout<<" 已成功修改该学生信息!";

cout<<"-------------------------------------"<<endl;

show_one(id);

wait();

}

}

void cj_delete() //学生信息的删除

{

int num,id,i;

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"※学生成绩信息删除菜单※"<<endl;

cout<<"◎请确认已经录入学生信息"<<endl;

cout<<"◎学号不存在即会返回菜单"<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"请输入要删除的学生学号:";

cin>>num;

id=id_search(num);

if (id==total)

{

cout<<endl;

cout<<"-〖系统提示〗------------------------"<<endl;

cout<<" 错误!无该学号学生信息!"<<endl;

cout<<"-------------------------------------"<<endl;

wait();

return;

}

show_one(id);

for (i=id;i<total;i++)

stu[i]=stu[i+1];

total=total-1;

cout<<endl;

cout<<" 学 生 成 绩 显 示 菜 单 "<<endl;

show_all();

cout<<endl;

cout<<"-〖系统提示〗------------------------"<<endl;

cout<<" 已成功删除该学生的信息!"<<endl;

cout<<"-------------------------------------"<<endl;

wait();

}

void func_1() //录入编辑菜单

{

char choice;

while(1)

{

system("cls");

cout<<" 学 生 成 绩 管 理 系 统 "<<endl;

cout<<"=============================================================="<<endl;

cout<<" ⑴录入成绩 "<<endl;

cout<<" ⑵修改成绩 "<<endl;

cout<<" ⑶删除成绩 "<<endl;

cout<<" ⑷返回上级 "<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<" 键入相应数字项进行功能选择(1-4) "<<endl;

choice=get_key();

if (choice=='1') cj_input(); //这里为测试方便,自动输入了成绩,注意改回

else if (choice=='2') cj_modify();

else if (choice=='3') cj_delete();

else if (choice=='4') break;

}

}

void show_person() //个人成绩查询

{

int num,id;

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"※学生成绩信息修改菜单※"<<endl;

cout<<"◎请确认已经录入学生信息"<<endl;

cout<<"◎学号不存在即会返回菜单"<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<"请输入要查询的学生学号:";

cin>>num;

id=id_search(num);

if (id==total)

{

cout<<endl;

cout<<"-〖系统提示〗------------------------"<<endl;

cout<<" 错误!无该学号学生信息!"<<endl;

cout<<"-------------------------------------"<<endl;

wait();

return;

}

show_one(id);

wait();

}

void cj_pm() //生成名次,即按照总分输出

{

int i,j;

for (j=0;j<total;j++)

{

for (i=0;i<total-j;i++)

{

if (stu[i]zf<stu[i+1]zf)

{

temp=stu[i];

stu[i]=stu[i+1];

stu[i+1]=temp;

}

}

}

cout<<endl;

cout<<" 学 生 成 绩 显 示 (按 总 分) "<<endl;

show_all();

wait();

}

void cj_xh() //按照学号输出

{

int i,j;

for (j=0;j<total;j++)

{

for (i=0;i<total-j;i++)

{

if (stu[i]xh>stu[i+1]xh)

{

temp=stu[i];

stu[i]=stu[i+1];

stu[i+1]=temp;

}

}

}

cout<<endl;

cout<<" 学 生 成 绩 显 示 (按 学 号) "<<endl;

show_all();

wait();

}

void cj_bk() //生成补考名单

{

int i;

cout<<" 补 考 名 单 "<<endl;

cout<<"=============================================================="<<endl;

cout<<"学号\t"<<"姓名\t"<<"语文\t"<<"数学\t"<<"英语\t"<<"计算机\t"<<endl;

for (i=0;i<total;i++)

{

if ((stu[i]yw<60)||(stu[i]sx<60)||(stu[i]yy<60)||(stu[i]jsj<60))

{

cout<<stu[i]xh<<'\t'<<stu[i]xm<<'\t';

if(stu[i]yw<60) cout<<"补考\t";

else cout<<'\t';

if(stu[i]sx<60) cout<<"补考\t";

else cout<<'\t';

if(stu[i]yy<60) cout<<"补考\t";

else cout<<'\t';

if(stu[i]jsj<60) cout<<"补考\t"<<endl;

else cout<<endl;

}

}

cout<<"--------------------------------------------------------------"<<endl;

wait();

}

void func_2() //成绩查询统计

{

char choice;

while(1)

{

system("cls");

cout<<" 学 生 成 绩 管 理 系 统 "<<endl;

cout<<"=============================================================="<<endl;

cout<<" ⑴个人成绩查询 "<<endl;

cout<<" ⑵班级排名查询 "<<endl;

cout<<" ⑶生成补考名单 "<<endl;

cout<<" ⑷返回上级 "<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<" 键入相应数字项进行功能选择(1-4) "<<endl;

choice=get_key();

if (choice=='1') show_person();

else if (choice=='2') cj_pm();

else if (choice=='3') cj_bk();

else if (choice=='4') break;

}

}

void func_3() //成绩打印与输出

{

char choice;

while(1)

{

system("cls");

cout<<" 学 生 成 绩 管 理 系 统 "<<endl;

cout<<"=============================================================="<<endl;

cout<<" ⑴按学号输出 "<<endl;

cout<<" ⑵按总分输出 "<<endl;

cout<<" ⑶返回上级 "<<endl;

cout<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<" 键入相应数字项进行功能选择(1-3) "<<endl;

choice=get_key();

if (choice=='1') cj_xh();

else if (choice=='2') cj_pm();

else if (choice=='3') break;

}

}

int main() //主函数开始

{

char choice;

while(1)

{

system("cls");

cout<<" 学 生 成 绩 管 理 系 统 "<<endl;

cout<<"=============================================================="<<endl;

cout<<" ⑴成绩录入与编辑 "<<endl;

cout<<" ⑵成绩查询与统计 "<<endl;

cout<<" ⑶成绩打印与输出 "<<endl;

cout<<" ⑷退出本管理系统 "<<endl;

cout<<"--------------------------------------------------------------"<<endl;

cout<<" 键入相应数字项进行功能选择(1-4) "<<endl;

choice=get_key();

if (choice=='1') func_1();

else if (choice=='2') func_2();

else if (choice=='3') func_3();

else if (choice=='4') break;

}

system("cls"); //版权信息

cout<<"[关于本系统]"<<endl;

- 无线电指令〕

1"Cover me" (掩护我)

2"You Take The Point"(你守住这个位置)

3"Hold This Position"(各单位保持现在的位置)

4"REGROUP TEAM"(重新组队),队友过于分散的时候可以用这个指令

5"Follow Me"(跟着我)

6"TAKING FIRE"(射击射击!!需要火力支援)

〔Group Radio Commands (" X "键) - 无线电指挥指令〕

1"Go"(全队 行动/前进)

2"Fall Back"(全队 撤退/后退)

3"Stick together team"(全队保持一起行动/保持队形)

4"Get in position and wait for my go" (全队就位,等我冲出去时掩护我)

5"Storm the front"(全队正面快速突进)

6"Report in"(询问全队队员回报行动是否准备OK)

〔Radio Reports (" C "键) - 无线电回覆〕

1"Affirmative/Roget"(收到/了解)

2"Enemy Spotted"(发现敌人)

3"need backup"(我需要支援)

4"Sector Clear"(此区域安全!!)

5"I'm in position"(我已经就定位!)

6"Reporting In"(回报行动准备OK)

7"She's gonna Blow!"(炸d要爆炸了!!)

8"Negative"(否定),用在回报行动准备尚未OK

9"ENEMY DOWN" (敌人死了)

以上就是关于使用Java语言编写程序,输出某公司员工的基本信息全部的内容,包括:使用Java语言编写程序,输出某公司员工的基本信息、用Java编写一个员工类程序:1.属性:员工编号,员工姓名,基本工资,奖金,2.构造方法:至少两个、C语言程序――职工信息管理系统等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10180987.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-06
下一篇2023-05-06

发表评论

登录后才能评论

评论列表(0条)

    保存