ImageVerifierCode 换一换
格式:DOCX , 页数:23 ,大小:19.06KB ,
资源ID:11053523      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/11053523.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(图书管理系统的C#代码完整版.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

图书管理系统的C#代码完整版.docx

1、图书管理系统的C#代码完整版C#代码清单共 1 个项目,包含 5 个类。项目: librarysystemMenu.cs类 : Program.cs Readers.cs Manage.csPublications.cs主类代码:namespace librarysystem / / 类名: Program/ 功能:项目主类/ 时间: 2015-11-19/ class Programstatic void Main( string args)Menu meu = new Menu ();meu.ShowMainMenu();Console .ReadLine();出版物类代码:namespa

2、ce librarysystem / / 类名: Publications/ 功能:馆藏出版物信息/ 时间: 2015-11-19/ class Publications/* 出版物编号 */private string PublicationISBN;public string PublicationIsbngetreturn PublicationISBN;setPublicationISBN = value ;/* 出版物名称 */public string PublicationName;/* 出版物作者或出版机构 */public string PublicationAuthor;/

3、* 出版物在架状态 */public bool PublicationStatus;/* 出版物类型 */public string PublicationType;public Publications()stringpublic Publications( string PublicationISBN, string PublicationName,PublicationAuthor, string PublicationType, bool PublicationStatus)this . PublicationISBN = PublicationISBN;this .Publicati

4、onName = PublicationName;this .PublicationAuthor = PublicationAuthor;this .PublicationType = PublicationType;this .PublicationStatus = PublicationStatus;读者类代码:namespace librarysystem / / 类名: Readers/ 功能:已获取权限读者的信息/ 时间: 2015-11-19/ class Readersprivate string ReaderID;public string ReaderIdgetreturn

5、ReaderID;setReaderID = value ; public string ReaderName;public string ReaderSex;public string ReaderDepartment;public string ReaderMajor;public string BowPublication = new string 10 , , , , , , , , , ;public Readers()public Readers( string ReaderID, string ReaderName, string ReaderSex, string Reader

6、Department, string ReaderMajor)this .ReaderID = ReaderID;this .ReaderName = ReaderName;this .ReaderSex = ReaderSex;this .ReaderDepartment = ReaderDepartment;this .ReaderMajor = ReaderMajor;管理类代码:namespace librarysystem / / 类名: Manage/ 功能:管理员执行图书管理操作/ 时间: 2015-11-19/ class Managepublic bool BorrowFla

7、g = false ;/* 借阅操作成功标志 */public bool ReturnFlag = false ;/* 归还操作成功标志 */public Publications pub_search; /* 保存查询到的出版物 */public Readers Red_valid; /* 保存查询到的合法用户 */* 声明馆藏出版物数组 */public Publications pubs= new Publications 200;/* 声明注册读者数组 */public Readers reds= new Readers 30;/* 实例化馆藏出版物对象 */public Public

8、ations pub0 = new Publications (000000 ,C# 从入门到精通 , 明日科技 ,书籍,true );public Publications pub1 = new Publications (000001 , 数值分析 , 清朗 , 书籍, true );public Publications pub2 = new Publications (000002 , 模式识别 , 学工 , 书籍, true );public志, true );Publicationspub3 = new Publications(000003 ,中国地理 , 地理科学院 , 杂pu

9、blicPublicationspub4 = new Publications(000004 ,意林 , 市文学艺术界联合会, 杂志, true );publicPublicationspub5 = new Publications(000005 ,大学报, 大学, 报纸 ,true );public Publications纸有限公司 , 杂志, true );pub6 = new Publications(000006 , 经济学人 , 伦敦经济学人报publicPublicationspub7 = new Publications(000007 ,计算机网络 , 谢希仁 , 书籍, tr

10、ue );publicPublicationspub8 = new Publications(000008 ,红楼梦, 曹雪芹 , 书籍,true );public洪, 音像制品 ,Publicationstrue );pub9 = new Publications(000009 , 新东方雅思培训课程 , 俞敏publicPublicationspub10 = new Publications(000010, MATLAB 实用教程 , 世杰, 音像制品 , true );/* 实例化已注册读者对象 */public Readers red0 = new Readers (20150000

11、, 华, 男, 电子信息学院 , 电子与通 信工程 );public Readers red1 = new Readers (20150001 , 王鹏, 男, 物理学院, 微电子学 );public Readers red2 = new Readers (20150002 , 建豪, 男, 数学学院 , 现代数学分 析);public Readers red3 = new Readers (20150003 , 莉, 女, 化学化工学院 , 化学分析 );public Readers red4 = new Readers (20150004 , 吴娜, 女, 医学院, 口腔医学 );publ

12、ic Readers red5 = new Readers (20150005 , 宋雅茹 , 女, 电子信息学院 , 光学 工程);/* 初始化出版物数组 */public void PublicationsInitial()pubs0 = pub0;pubs1 = pub1;pubs2 = pub2;pubs3 = pub3;pubs4 = pub4;pubs5 = pub5;pubs6 = pub6;pubs7 = pub7;pubs8 = pub8;pubs9 = pub9;pubs10 = pub10;/* 初始化读者数组 */ public void ReadersInitial(

13、)reds0 = red0;reds1 = red1;reds2 = red2;reds3 = red3;reds4 = red4;reds5 = red5;/* 查询图书操作 */public bool SearchPublications()string Pub_Name;bool SearchFlag = false ;Pub_Name = Console .ReadLine();foreach (Publications pub in pubs)if (pub != null & pub.PublicationName = Pub_Name)SearchFlag = true ;pub

14、_search = pub;return SearchFlag;/* 借阅图书操作 */public void Borrow()string Red_Name;string Pub_Name;bool ReaderFlag = false ;Red_Name = Console .ReadLine();foreach (Readers red in reds)if (red != null & red.ReaderName = Red_Name)ReaderFlag = true ;Red_valid = red;if (ReaderFlag)Console .Write( 请输入您需要借阅出

15、版物的名称 :);Pub_Name = Console .ReadLine();foreach (Publications pub in pubs)if (pub != null & pub.PublicationName = Pub_Name)BorrowFlag = true ;pub.PublicationStatus = false ;AddToReders(pub.PublicationName, Red_valid);elseConsole .WriteLine( 抱歉,您是非法读者,不能借阅图书 );/* 归还图书操作 */public void Return()string R

16、ed_Name;string Pub_Name;bool ReaderFlag = false ;Red_Name = Console .ReadLine();foreach (Readers red in reds)if (red != null & red.ReaderName = Red_Name)ReaderFlag = true ;Red_valid = red;if (ReaderFlag)Console .Write( 请输入您需要归还出版物的名称 :);Pub_Name = Console .ReadLine();foreach (Publications pub in pub

17、s)if (pub != null & pub.PublicationName = Pub_Name)for (int i = 0; i 10;i+ )if (Red_valid.BowPublicationi = Pub_Name)ReturnFlag = truepub.PublicationStatus = true ;RemoveFromReders(Pub_Name, Red_valid);elseConsole .WriteLine( 抱歉,您是非法读者,无归还图书信息 );/* 添加图书到读者 */private void AddToReders( string Publicat

18、ionName, Readers red)/* 设置借阅上限为 10本*/for (int i = 0; i 10; i+)if (red != null & red.BowPublicationi= )red.BowPublicationi = PublicationName;break ;/* 从读者对象中移除图书 */private void RemoveFromReders( string PublicationName, Readers red) /* 设置借阅上限为 10本*/for (int i = 0; i 10; i+)if (red != null & red.BowPub

19、licationi = PublicationName)red.BowPublicationi = red.BowPublicationi+1;/* 新书入库操作 */public void AddPublications( Publications pub)for (int i = 11; i 200; i+)if (pubsi= null )pubsi = pub;/* 添加新读者操作 */public void AddReaders( Readers red)for (int i = 6; i 30; i+)if (redsi = null )redsi = red;/* 查询读者信息

20、*/public void RedIndex()string Red_Name;bool ReaderFlag = false ;foreach (Readers red in reds)if (red != null & red.ReaderName = Red_Name)ReaderFlag = true ;Red_valid = red;if (!ReaderFlag)Console .WriteLine( 抱歉,您是非法读者,无法查到您的借阅信息 );菜单类代码:namespace librarysystem / / 类名: Menu/ 功能:显示服务页面/ 时间: 2015-11-1

21、9/ class Menu/ 创建一个具体的管理对象Manage mag = new Manage ();/ 声明一个读者对象Readers red;/ 声明一个出版物对象Publications pub;public void ShowMainMenu()mag.PublicationsInitial();mag.ReadersInitial();Console .WriteLine( 欢迎使用图书管理系统 V1.0 );Console .WriteLine( );Console .WriteLine( 1. 查询图书 );Console .WriteLine( 2. 借书服务 );Cons

22、ole .WriteLine( 3. 还书服务 );Console .WriteLine( 4. 新出版物入库 );Console .WriteLine( 5.录入新读者 );Console .WriteLine( 7. 退出管理系统 );Console .WriteLine( );bool flag;doflag = false ;Console .WriteLine( 请选择: );string key = Console .ReadLine();switch (key)case 1 :Console .Write( 请输入需要查询图书的书名: );ShowPubInfo();break

23、;case 2 :Console .Write( 请输入您的姓名: );mag.Borrow();ShowBorrowInfo();break ;case 3 :mag.Return();ShowReturnInfo();break ;case 4 :Console .WriteLine( 请按照提示逐步输入需要入库出版物的信息 );ShowAddPublications();break ;case 5 :Console .WriteLine( 请按照提示逐步输入新注册读者的信息 );ShowAddReaders();break ;case 6 :Console .Write( 请输入您的姓名

24、: );mag.RedIndex();ShowRedPubInfo(mag.Red_valid);break ;case 7 :flag = false ;break ;default :Console .WriteLine( 无此业务,是否重新选择( y/n )? );string answer = Console .ReadLine();if (answer != y )flag = false ;elseflag = true ;break ; while (flag);/* 显示查询到的出版物信息 */public void ShowPubInfo()if (mag.SearchPub

25、lications()Console .WriteLine( 您要查询的出版物信息: );Console .WriteLine( 编号: + mag.pub_search.PublicationIsbn);Console.WriteLine( 出版物名字: + mag.pub_search.PublicationName);Console.WriteLine( 出版物作者: + mag.pub_search.PublicationAuthor);Console.WriteLine( 出版物类型: + mag.pub_search.PublicationType);if (mag.pub_sea

26、rch.PublicationStatus)Console .WriteLine( 出版物状态: 在架,可借 );elseConsole .WriteLine( 出版物状态: 未在架,不可借 );Console .WriteLine( );Console .WriteLine( );Console .WriteLine( );Console .WriteLine( 是否办理其他业务 (y/n)? );string answer = Console .ReadLine();if (answer = y )ShowMainMenu();elseConsole .WriteLine( 结束 );el

27、seConsole .WriteLine( 抱歉,未找到该图书! );Console .WriteLine( 是否办理其他业务 (y/n)? ); string answer = Console .ReadLine();if (answer = y )ShowMainMenu();Console .WriteLine();Console .WriteLine();elseConsole .WriteLine( 结束 );/* 显示借阅操作结果 */public void ShowBorrowInfo()if (mag.BorrowFlag)Console .WriteLine( 恭喜,借阅成功! );ShowRedPubInfo(mag.Red_valid);elseConsole .WriteLine( 抱歉 ,借阅失败! );Console .WriteLine( 是否办理其他业务 (y/n)? );string answer = Console .ReadLine();if (answer = y )ShowMainMenu();else/* 显示归还操作结果 */pub

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1