• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

导入Java。util。ArrayList

导入Java。util。列表;

导入Java。util。扫描仪;

公共类优先{

静态list book a=new ArrayList book();

静态{

书籍b1=新书(' 1 ',' 1 ',1);

答。添加(B1);

书b2=新书(' 2 ',' 2 ',2);

答。添加(B2);

书b3=新书(' 3 ',' 3 ',3);

答。添加(B3);

}

公共静态void main(String[] args) {

mune();

}

公共静态void mune() {

for(;) {

系统。出去。println(' * * * * * * * * * * * * * * * * * * *);

System.out.println('* 1,添加图书*');

System.out.println('* 2,删除图书*');

System.out.println('* 3,修改图书*');

System.out.println('* 4,查询所有图书*');

System.out.println('* 5,查询一本图书*');

System.out.println('* 0,退出程序*');

系统。出去。println(' * * * * * * * * * * * * * * * * * * *);

int i=inputInt('请输入要选择的操作:');

开关{

案例1:

addbook();

打破;

案例2:

del book();

打破;

案例3:

更新本书();

打破;

案例4:

查找所有书籍();

打破;

案例5:

findbookByName();

打破;

案例0:

返回;

默认:

System.out.println('请重新输入');

打破;

}

}

}

私有静态void findbookByName() {

String name=inputStr('请输入要查找的图书名称');

int index=0;

System.out.println('id\t图书名称\t价格');

对于(书书: a) {

如果(姓名。等于(书。getname()){

系统。出去。println(书。getid()' \ t ' book。getname()' \ t '

书。getprice());

}

指数;

}

}

私有静态void findAllbook() {

System.out.println('id\t图书名称\t价格');

对于(书书: a) {

系统。出去。println(书。getid()' \ t ' book。getname()' \ t '

书。getprice());

}

}

私有静态void updatebook() {

String id=inputStr('请输入要修改的图书id’);

int index=0;

对于(书书: a) {

如果(id。等于(书。getid()){

book.setName(inputStr('请输入修改后的名称:'));

book.setPrice(inputDouble('请输入修改后的价格:'));

答。移除(索引);

a .添加(索引,书);

}

指数;

}

}

私有静态void delbook() {

String id=inputStr('请输入要删除的图书id’);

int index=0;

对于(书书: a) {

如果(id。等于(书。getid()){

答。移除(索引);

}

指数;

}

}

私有静态void addbook() {

String id=inputStr('请输入图书id’);

String name=inputStr('请输入图书名称');

double price=inputDouble('请输入图书价格');

book book=新书(id,名称,价格);

a .添加(书);

}

公共静态字符串输入Str(字符串消息){

系统。出去。打印(msg);

退回新扫描仪(系统输入).下一行();

}

public static int input int(String msg){

系统。出去。打印(msg);

退回新扫描仪(系统输入).nextInt();

}

公共静态双输入双输出(字符串消息){

系统。出去。打印(msg);

退回新扫描仪(系统输入).next double();

}

}

公共类图书{

私有字符串id;

公共字符串getId() {

返回id;

}

公共void集合id(字符串id) {

this.id=id

}

公共字符串getName() {

返回名称;

}

公共void集合名称(字符串名){

this.name=name

}

public double getPrice() {

退货价格;

}

公共无效定价(双倍价格){

this.price=价格;

}

私有字符串名称;

私人双倍价格;

公共图书(字符串id,字符串名称,双价格){

super();

this.id=id

this.name=name

this.price=价格;

}

}

wgwdxaz10gj3284.png

3

创建表书(id int(10),name char(10),price double(10));

插入到图书(id、名称、价格)值(1,' 1 ',20);

从书籍中删除,其中name=' java

从名称相似的图书中删除我%';

从图书中删除;

更新图书设置价格=18.8,其中价格20;

从书本中选择*

select * from Book where price5

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now