//借书卡操作
import java.util.Scanner;
public class JieShuKa{
String zhanghao,name;
int ID,yijie,yihuan;
int kejie=20;
void borrow(int cash){
if(kejie>=cash){
kejie=kejie-cash;
System.out.println("本次借书数为:"+cash);
System.out.println("还可借书数为:"+kejie);
}
}
void theReturn(int cash){
yihuan=yihuan+cash;
System.out.println("本次还书:"+cash);
}
}
class BookCard extends JieShuKa{
void bookcard(String name,String zhanghao,int ID){
System.out.println("持卡人姓名:"+name+"持卡人账号:"+zhanghao+"身份证号:"+ID);
}}
public class Card {
public static void main(String[] args){
String name,zhanghao;
int ID;
int s1,s2,s3;
Scanner ss=new Scanner(System.in);
System.out.println("请输入持卡人姓名:");
name=ss.nextLine();
System.out.println("请输入持卡人账号:");
zhanghao=ss.nextLine();
System.out.println("请输入持卡人身份证号:");
ID=ss.nextInt();
BookCard str1=new BookCard();
str1.bookcard(zhanghao, zhanghao, ID);
JieShuKa str2=new JieShuKa();
System.out.println("请输入本次借书数:");
s1=ss.nextInt();
str2.borrow(s1);
System.out.println("请输入本次还书数:");
s3=ss.nextInt();
str2.theReturn(s3);
}
}
import java.util.Scanner;
public class JieShuKa{
String zhanghao,name;
int ID,yijie,yihuan;
int kejie=20;
void borrow(int cash){
if(kejie>=cash){
kejie=kejie-cash;
System.out.println("本次借书数为:"+cash);
System.out.println("还可借书数为:"+kejie);
}
}
void theReturn(int cash){
yihuan=yihuan+cash;
System.out.println("本次还书:"+cash);
}
}
class BookCard extends JieShuKa{
void bookcard(String name,String zhanghao,int ID){
System.out.println("持卡人姓名:"+name+"持卡人账号:"+zhanghao+"身份证号:"+ID);
}}
public class Card {
public static void main(String[] args){
String name,zhanghao;
int ID;
int s1,s2,s3;
Scanner ss=new Scanner(System.in);
System.out.println("请输入持卡人姓名:");
name=ss.nextLine();
System.out.println("请输入持卡人账号:");
zhanghao=ss.nextLine();
System.out.println("请输入持卡人身份证号:");
ID=ss.nextInt();
BookCard str1=new BookCard();
str1.bookcard(zhanghao, zhanghao, ID);
JieShuKa str2=new JieShuKa();
System.out.println("请输入本次借书数:");
s1=ss.nextInt();
str2.borrow(s1);
System.out.println("请输入本次还书数:");
s3=ss.nextInt();
str2.theReturn(s3);
}
}