using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _13._10
{
class staff
{
public int code;
public string name;
public staff(int c, string n)
{
code = c;
name = n;
}
}
class teacher : staff
{
public string subject;
public string publication;
public teacher(int c, string n, string sub, string pub)
: base(c, n)
{
subject = sub;
publication = pub;
}
public void update(int c, string n, string sub, string pub)
{
code = c; name = n; subject = sub; publication = pub;
}
public void display()
{
Console.WriteLine("Code:" + code + "\t Name:" + name + "\tsub:" + subject + "\tpub:" + publication);
}
}
class officer : staff
{
public string grade;
public officer(int c, string n, string g)
: base(c, n)
{
grade = g;
}
public void update(int c, string n, string g)
{
code = c; name = n; grade = g;
}
public void display()
{
Console.WriteLine("Code:" + code + "\t Name:" + name + "\tgrade"+grade );
}
}
class typist : staff
{
public string speed;
public typist(int c, string n, string sp)
: base(c, n)
{
speed = sp;
}
}
class regular : typist
{
public regular(int c, string n, string sp)
: base(c, n, sp)
{
}
public void update(int c, string n, string sp)
{
code = c; name = n; speed = sp;
}
public void display()
{
Console.WriteLine("Code:" + code + "\t Name:" + name + "\tSpeed:" + speed);
}
}
class casual : typist
{
int dailywages;
public casual(int c, string n, string sp, int dw)
: base(c, n, sp)
{
dailywages = dw;
}
public void update(int c, string n, string sp,int dw)
{
code = c; name = n; dailywages = dw; speed = sp;
}
public void display()
{
Console.WriteLine("Code:" + code + "\t Name:" + name + "\tspeed:" + speed + "\tdailywages:" + dailywages );
}
}
class Program
{
static void Main(string[] args)
{
teacher t = new teacher(0, "", "", "");
casual c = new casual(0, "", "", 0);
regular r = new regular(0, "", "");
officer o = new officer(0, "", "");
while (true)
{
Console.WriteLine("Enter the choice:\n1.Insert\n2.Delete\n3.Update\n4.display\n5.Exit");
int ch = int.Parse(Console.ReadLine()), choice;
switch (ch)
{
case 1: Console.WriteLine("Select:\n1.Teacher\n2.Casual typist\n3.Regular typist\n4.officer\n");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1: Console.WriteLine("Enter code name sub pub\n");
t = new teacher(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine(), Console.ReadLine());
break;
case 2: Console.WriteLine("Enter code name speed dailywages\n");
c = new casual(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine(), int.Parse(Console.ReadLine()));
break;
case 3: Console.WriteLine("Enter code name speed");
r = new regular (int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine());
break;
case 4: Console.WriteLine("Enter code name grade");
o = new officer(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine());
break;
}
break;
case 2: Console.WriteLine("Select:\n1.Teacher\n2.Casual typist\n3.Regular typist\n4.officer\n");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
t.update(0, "", "", "");
break;
case 2:
c.update(0,"", "",0);
break;
case 3:
r.update(0, "", "");
break;
case 4:
o.update(0, "", "");
break;
}
break;
case 3: Console.WriteLine("Select:\n1.Teacher\n2.Casual typist\n3.Regular typist\n4.officer\n");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1: Console.WriteLine("Enter code name sub pub\n");
t.update(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine(), Console.ReadLine());
break;
case 2: Console.WriteLine("Enter code name speed dailywages\n");
c.update(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine(), int.Parse(Console.ReadLine()));
break;
case 3: Console.WriteLine("Enter code name speed");
r.update(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine());
break;
case 4: Console.WriteLine("Enter code name grade");
o.update(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine());
break;
}
break;
case 4: Console.WriteLine("Select:\n1.Teacher\n2.Casual typist\n3.Regular typist\n4.officer\n");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
t.display();
break;
case 2:
c.display();
break;
case 3:
r.display();
break;
case 4:
o.display();
break;
}
break;
case 5:
return;
}
}
}
}
}
emp-db.rar_in
版权申诉
107 浏览量
2022-09-21
18:29:29
上传
评论
收藏 1KB RAR 举报
alvarocfc
- 粉丝: 109
- 资源: 1万+
最新资源
- (大赛作品)STM32实现的F072RB NUCLEO智能家居控制.zip
- STM32实现的数字示波器源码+数字信号处理教程、配套实例.zip
- 【cookie续续】【cookie续续】【cookie续续】
- 低功耗STM32实现的F411开发板(原理图+PCB源文件+官方例程+驱动等).zip
- 基于stm32实现的 nucleo-L476的智能灯(操作说明+源码).zip
- 基于STM32实现的 NUCLEO板设计彩色LED照明灯(纯cubeMX开发).zip
- 基于STM32实现的 的联合调试侦听设备解决方案(原理图、PCB源文件、调试工具、视频).zip
- 基于STM32实现的 人群定位、调速智能风扇设计(程序、设计报告、视频演示).zip
- 哔哩下载姬(DownKyi)
- 千纬认字app再次更新,增加部首、笔画动画功能
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈