1 问题
本次我们要提出的问题是设计一个简易的图书管理系统可以使图书管理变得不再那么困难。
2 方法
先建造一个Book的类,包含了书名、作者、价格、类型和是否被借的属性,且设置为private类型,提供了get和set方法。还有就是用户端的实现,同样使用get和set的方法。
代码清单 1
public class Book { private String name; private String author; private int price; private String type; private boolean isBorrowed; //是否被借 public Book(){ } public Book(String name,String author,int price,String type){ this.author = author; this.name = name; this.price = price; this.type = type; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getAuthor(){ return author; } public int getPrice(){ this.price = price; } public String getType(){ return type; } public void setType(String type){ this.type = type; } public boolean isBorrowed(){ return isBorrowed; } public void setBorrowed(boolean borrowed){ isBorrowed = borrowed; } public String toString(){ return "Book{" + "书名:'" + name + '\''+ ",作者:'" + author + '\''+ ",价格:'" + price + ",类型:'" + type +'\'' + ",是否借出:" + isBorrowed +'}'; } } |
3 结语
本次作业主要使用了类来完成,使用这个系统可以实现基础的借书流程,并且可以查询是谁借的,借的什么类型以及是否借出。但是这个系统提升空间还有很多,我们下来有时间继续完善此程序,类的用途很广泛,方便又简洁。在学习中,我认为自己还有很多不足,虽然书上的代码每周都认真重复敲,但还是有些不熟练,编写较长代码还是有困难,这学期课程比较有难度,因此很少有自己主动编写的程序,后面应该找时间完善自己的全部作品。
到此这篇数据库课程设计图书管理系统(数据库课程设计图书管理系统数据类型定义)的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/sjkxydsj/27828.html