Ruby入门指南:随Ruby安装的免费教程

需积分: 10 1 下载量 158 浏览量 更新于2024-07-28 收藏 2.93MB PDF 举报
《Ruby入门手册》(Book Of Ruby),由Huw Collingbourne所著,版权归属2009年,根据1988年的英国版权、设计和专利法进行保护。该书作为Ruby语言的基础教程,是Ruby安装目录中的官方资源,无需额外下载即可获取。Huw Collingbourne不仅是本书的作者,同时也是Sapphire Steel Software的科技总监,该公司开发了面向Ruby和Rails的Visual Studio IDE——“Ruby in Steel”以及Adobe Flex的IDE——“Amethyst”。Collingbourne在英国技术领域享有盛誉,他撰写了众多技术文章,包括关于C#、Delphi、Java、Smalltalk和Ruby等编程语言的教程,曾在诸如《Computer Shopper》、《PC Pro》和《PC Plus》等计算机杂志上发表多篇文章。 书中涵盖了Ruby语言的基础知识,适合初学者系统地学习Ruby语法、对象导向编程、类和模块的概念、异常处理、以及Ruby on Rails框架的基础应用。通过阅读这本书,读者将了解到Ruby的简洁优雅和动态特性,包括它的元编程能力,这使得Ruby成为许多开发者喜爱的脚本语言之一。 作为一本实践导向的教材,书中还可能包含实例代码、调试技巧和最佳实践,帮助读者逐步掌握如何编写高效、可维护的Ruby程序。此外,Huw Collingbourne的专业背景和丰富经验为理解复杂的编程概念提供了坚实的支持,使得读者不仅能掌握技术知识,还能了解到如何将其应用于实际项目中。 《Book Of Ruby》是一本全面且实用的Ruby入门指南,无论是想要学习编程的新手还是希望深入了解Ruby语言的开发者,都能从中受益匪浅。通过阅读这本书,读者可以建立起坚实的Ruby基础,并为进一步深入学习Ruby或Ruby on Rails打下坚实的基础。

use java language ,In this project you need to write a book lending system for a Library. The system has different roles for registered users. There are two types of user roles: borrower and lender. Write an IUser interface for library users, with the following UML specification: +----------------------------------+ | <<interface>> | | IUser | +----------------------------------+ | + getName(): String | | + getBook(): int | | + moreBook(int number): void | +----------------------------------+ and a User class that implements IUser and has the following UML specification: +-----------------------------------+ | User | +-----------------------------------+ | - name: String | | - book: int | +-----------------------------------+ | + User(String name, int book) | | + getName(): String | | + getBook(): int | | # setBook(int book): void | | + moreBook(int number): void | | + testUser(): void | +-----------------------------------+ The name instance variable indicates the user name. The book instance variable indicates the number of books borrowed by the user. The setBook method changes the number of books borrowed by the user. The setBook method is protected, not public. This means that only subclasses of the User class can use the setBook method. All the other classes in the system cannot use the setBook method, so they cannot change the number of books borrowed by a user. The purpose of the moreBook method is to increase the number of books borrowed or lent by the user (depending on what kind of user it is) by the number given as argument to the method. The moreBook method of the User class is abstract, since we do not know what kind of role the user is (a borrower borrows books from other users and a lender lend books to other users). Also add to your program a Test class to test your User class. public class Test { public static void main(String[] args) { User.testUser(); } }

2023-05-25 上传