电子书阅读| z-library + 微信

最近我姐给我推荐了一本书,名字叫《底层逻辑》。想着下载来看看,能尽量读电子版,就还是读电子版的,毕竟方便携带,还能多设备同步,有空闲时间,随时随地都能打开看一看。

通过下载这本书,总结流程如下:

  1. 有一本想读的书
  2. 下载到电子书的epub版本(我这里用的是z-library,找到了《底层逻辑》这本书)
    链接如下:Electronic library. Download books free. Finding booksicon-default.png?t=M0H8https://u1lib.org/
  3. 手机上安装“微信读书”app
    电脑端的是网页版,链接如下
    微信读书-正版书籍小说免费阅读微信读书提供海量正版书籍、小说、漫画、公众号、听书,多设备同步实现跨屏阅读。与微信好友一起发现更多精品好书,随时交流感想,让阅读不再孤独。https://weread.qq.com/ 
  4. 在微信网页版点击“传书到手机”,然后将下载到的epub格式的电子书拖入。

    或者,通过手机端“微信读书”app导入epub格式的电子书
    (我采用的是这种方式,将电子书发送给手机的“文件传输助手”,然后从微信导入)

 

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(); } }
05-25
Sure, I can help you with that! Here's the code for the IUser interface and User class: IUser interface: ```java public interface IUser { String getName(); int getBook(); void moreBook(int number); } ``` User class: ```java public class User implements IUser { private String name; private int book; public User(String name, int book) { this.name = name; this.book = book; } @Override public String getName() { return name; } @Override public int getBook() { return book; } protected void setBook(int book) { this.book = book; } public void moreBook(int number) { // abstract method, implementation will be provided in subclasses } public static void testUser() { User borrower = new Borrower("John", 2); User lender = new Lender("Jane", 5); System.out.println("Borrower " + borrower.getName() + " has " + borrower.getBook() + " books borrowed."); System.out.println("Lender " + lender.getName() + " has " + lender.getBook() + " books lent."); borrower.moreBook(1); lender.moreBook(3); System.out.println("Borrower " + borrower.getName() + " has " + borrower.getBook() + " books borrowed."); System.out.println("Lender " + lender.getName() + " has " + lender.getBook() + " books lent."); } } ``` The User class has a constructor that takes a name and a number of books as arguments. It also implements the methods of the IUser interface. The setBook method is protected, meaning it can only be accessed by subclasses of User. The moreBook method is abstract, as its implementation will depend on the type of user (borrower or lender). This will be implemented in the subclasses. Here's an example of two subclasses, Borrower and Lender, that extend User and implement the moreBook method: ```java public class Borrower extends User { public Borrower(String name, int book) { super(name, book); } @Override public void moreBook(int number) { setBook(getBook() + number); } } public class Lender extends User { public Lender(String name, int book) { super(name, book); } @Override public void moreBook(int number) { setBook(getBook() - number); } } ``` The Borrower class increases the number of books borrowed, while the Lender class decreases the number of books lent. And finally, here's the Test class to test the User class: ```java public class Test { public static void main(String[] args) { User.testUser(); } } ``` This will create a Borrower and a Lender object, print their initial number of books, call the moreBook method on both objects, and print the new number of books.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱菠萝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值