婷婷人人超碰五月天_久久综合segui_97色色超级碰碰_福利姬国产AV网站

歡迎來到中博奧技術(shù)有限公司官網(wǎng)

java簡易圖書管理系統(tǒng)

時(shí)間:2023-02-01 作者:老師 來源:網(wǎng)絡(luò) 點(diǎn)擊量:

java簡易圖書管理系統(tǒng)

從零開始學(xué)Java,本來利用數(shù)組只在一個(gè)界面就可以實(shí)現(xiàn)增刪改查功能,學(xué)到接口后覺得實(shí)現(xiàn)分離效果會更好一些!所以進(jìn)行了嘗試,將管理員和用戶中的圖書查詢,登錄,圖書出庫合并在一起寫了一個(gè)接口,用戶類和管理員類實(shí)現(xiàn)這個(gè)接口!圖書類寫了一個(gè)抽象類里面都是一些圖書的屬性,用戶類管理員類對圖書類進(jìn)行操作。

具體實(shí)現(xiàn)如下:

java簡易圖書管理系統(tǒng)

接口:存在三種方法 ?用戶類和管理員類去實(shí)現(xiàn)這個(gè)接口,并實(shí)現(xiàn)著里面的方法

[java]?view plain?copy

JAVA版的圖書管理系統(tǒng)

java簡易圖書管理系統(tǒng)

送你一份代碼,結(jié)構(gòu)大致按照你的需求了,自己增加一些小功能,不會的話請教你同學(xué)。
分給我,錢就不用了。

#include <string.h>
#define FORMAT "\n%-8d%-8d%-7d%-8d%-7d%-8d%-10s%-9s%-9s\n"
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
#define NULL 0
#define N 100
#define LEN sizeof(struct book)
int M;
struct book
{int Enum;
int Cnum;
char name[10];
char author[10];
char publishor[30];
struct date
{int year;
int month;
int day;}time;
int price;
struct book*next;
}go[N];

void print()
{printf("---------------------------------------------------------------------------\n");
printf("Enum Cnum year month day price name author publishor\n");
printf("---------------------------------------------------------------------------\n");
}
void load()
{FILE *fp;
int i;
if((fp=fopen("book_list","rb"))==NULL)
{printf("cannot open file\n");
return;
}
i=0;
while((fread(&go[i],sizeof(struct book),1,fp))!=NULL)
{i++;}
M=i;
fclose(fp);
}

void save(int h)
{FILE *fp;
int i;
if ((fp=fopen("BOOK_LIS","wb"))==NULL)
{printf("cannot open file\n");
return;
}
for (i=0;i<h;i++)
if(fwrite(&go[i],sizeof(struct book),1,fp)!=1)
printf("file write error\n");
fclose(fp);
}

void f1()
{FILE *fp;
int i=0;
fp=fopen("book_list","rb");
print();
while((fread(&go[i],sizeof(struct book),1,fp))!=NULL)
{printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
i++;
}
fclose(fp);
getch();
}

void f2(int h)
{int i;
printf("please input %d book's information\n",h);
printf("Enum Cnum year month day price name author publishor\n");
for(i=0;i<h;i++)
{printf("Enum:\n");
scanf("%d",&go[i].Enum);
printf("Cnum:\n");
scanf("%d",&go[i].Cnum);
printf("please input year month day\n");
scanf("%d%d%d",&go[i].time.year,&go[i].time.month,&go[i].time.day);
printf("price:\n");
scanf("%d",&go[i].price);
printf("name:\n");
scanf("%s",go[i].name);
printf("author:\n");
scanf("%s",go[i].author);
printf("publishor:\n");
scanf("%s",go[i].publishor);
}
save(h);
return;
}

void f3()
{int i;
struct book;
char a[20],b[20],c[20];
load();
printf("please input 'name' or 'author':\n");
scanf("%s",a);
if(strcmp(a,"name")==0)
{printf("please input the book's name:\n");
scanf("%s",b);
for(i=0;i<M;i++)
if(strcmp(b,go[i].name)==0)
{print();
printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
}
}
else
{printf("please input the book's author:\n");
scanf("%s",c);
for(i=0;i<M;i++)
if(strcmp(c,go[i].author)==0)
{print();
printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
}
}
return;
}

void f4()
{int i,j,k;
struct book t;
load();
for(i=0;i<M;i++)
{k=i;
for(j=i+1;j<M;j++)
if(go[k].price>go[j].price)k=j;
t=go[i];go[i]=go[k];go[k]=t;
}
print();
for(i=0;i<M;i++)
printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
}

void f5()
{FILE *fp;
int i,j,M,flag;
char name[10];
if((fp=fopen("book_list","rb"))==NULL)
{printf("cannot open file\n");
return;
}
printf("\norriginal data:\n");
print();
for(i=0;fread(&go[i],sizeof(struct book),1,fp)!=0;i++)
printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
M=i;
printf("\n input the deleted name:\n");
scanf("%s",name);
for(flag=1,i=0;flag&&i<M;i++)
{if(strcmp(name,go[i].name)==0)
{for(j=i;j<M-1;j++)
{go[j].Enum=go[j+1].Enum;
go[j].Enum=go[j+1].Enum;
strcpy(go[j].name,go[j+1].name);
strcpy(go[j].author,go[j+1].author);
strcpy(go[j].publishor,go[j+1].publishor);
go[j].time.year=go[j+1].time.year;
go[j].time.month=go[j+1].time.month;
go[j].time.day=go[j+1].time.day;
go[j].price=go[j+1].price;
}
flag=0;
}
}
if(!flag)
M=M-1;
else
printf("not found!\n");
printf("\nNow,the content of file:\n");
fp=fopen("book_list","wb");
for(i=0;i<M;i++)
fwrite(&go[i],sizeof(struct book),1,fp);
fclose(fp);
fp=fopen("book_list","wb");
for(i=0;fread(&go[i],sizeof(struct book),1,fp)!=0;i++);
printf(FORMAT,go[i].Enum,go[i].Cnum,go[i].time.year,go[i].time.month,go[i].time.day,go[i].price,go[i].name,go[i].author,go[i].publishor);
fclose(fp);
}

main()
{int i,h;
clrscr();
while(1)
{printf ("\n 1 is a project that can output all information.\n");
printf ("\n 2 is a project that can add any book's information.\n");
printf ("\n 3 is a project that can search information.\n");
printf ("\n 4 is a project that can sort.\n");
printf ("\n 5 is a project that can del.\n");
printf ("\n 6 is a project that can leave.\n");
printf("please input number:1 or 2 or 3 or 4 or 5 or 6\n");
scanf("%d",&i);
switch (i)
{case 1:f1();break;
case 2:
{printf ("if you want to add book's information,please input a data:h=");
scanf("%d",&h);
f2(h);}break;
case 3:
{f3();getch();}break;
case 4:{f4();getch();}break;
case 5:{f5();getch();}break;
case 6:exit (1);
}

clrscr();}
}

用java語言編寫 圖書館管理系統(tǒng)

工程量比較大!主要是數(shù)據(jù)庫設(shè)計(jì)、用戶介面設(shè)計(jì)。數(shù)據(jù)庫連接建議使用JDBC純JAVA驅(qū)動。

用java編寫一個(gè),圖書管理系統(tǒng)

可以使用Baiduhi告訴我你的題目
有空能搞定你無法解決的題目
如果你有類似的要求也能聯(lián)系我

ES:\\F3BE205E98C61E3942B3CDFC44D10E6F
交易提醒:預(yù)付定金有風(fēng)險(xiǎn)
交易提醒:用戶名中包含聯(lián)系方式勿輕信

JAVA做一個(gè)簡單的圖書管理系統(tǒng),不需要用圖形狀編程,直接在MAIN里面寫就可以了,數(shù)據(jù)庫用SQLSERVER!~

你哪部分不會,我們可以幫你做下。這么大的一個(gè)項(xiàng)目,做一下太費(fèi)時(shí)間了。

用java編寫一個(gè) 圖書館圖書借閱管理系統(tǒng)

---------------------------------------------------
給你修改了三個(gè)地方:

1.borrowBooks方法中,將System.out.println("你要借嗎?"); 改為:
System.out.println("你要借嗎?輸入1表示借,其他數(shù)字表示不借。");

保證輸入的時(shí)候輸入的數(shù)字,否則會報(bào)出異常。

2.borrowBooks方法中,將self[score] = all[9]; 改為:self[score] = all[i];

如果是all[9],那么就始終是最后一本書籍信息了。

3.have方法中,你是想將所借的書籍信息都打印出來。修改的比較多,下面注釋代碼是原來的。
void have(Books[] self) {
// for (int i = 0; i < 2; i++) {
// self[i].showBookInfo();
// }

for (int i = 0; i < 3; i++) {
if(self[i]!=null)
self[i].showBookInfo();
}
}

****************** 附上所有代碼:*************************

import java.util.Scanner;

public class TestBook {
public static void main(String[] args) {
Books all[] = new Books[10];
Books self[] = new Books[3];
all[0] = new Books("java", 1, "12345", "tom", 34.0f, "人民出版社");
all[1] = new Books("c", 2, "12346", "tnn", 31.0f, "人民出版社");
all[2] = new Books("c++", 3, "12445", "mm", 35.0f, "人民出版社");
all[3] = new Books("c#", 4, "12365", "tt", 38.0f, "人民出版社");
all[4] = new Books("j2se", 5, "13345", "tosm", 31.1f, "人民出版社");
all[5] = new Books("j2ee", 6, "18345", "ttm", 32.0f, "人民出版社");
all[6] = new Books("jsp", 7, "12335", "cc", 33.0f, "人民出版社");
all[7] = new Books("net", 8, "12341", "bb", 36.0f, "人民出版社");
all[8] = new Books("ip", 9, "12343", "aa", 37.0f, "人民出版社");
all[9] = new Books("tcp", 10, "22345", "jj", 39.0f, "人民出版社");
Readers r = new Readers("xiaoming", 101, "1", 3);
r.searchAllBooks(all);
r.borrowBooks(all, self);
r.have(self);
r.give(all, self);
}
}

class Readers {
Scanner scan = new Scanner(System.in);
String names;
int nums;
String classes;
int grade;
int score = 0;

// Books self[]=new Books[3];
Readers(String n, int u, String c, int g) {
names = n;
nums = u;
classes = c;
grade = g;
}

void searchAllBooks(Books[] all) {// 查書
for (int i = 0; i < 10; i++)
all[i].showBookInfo();
// self[score]=all[0];
}

void give(Books[] all, Books[] self) {// 還書
System.out.println("請輸入您要還的書的書號");
int n = scan.nextInt();
for (int i = 0; i < 10; i++) {
if (n == all[i].num) {
for (int j = 0; j < 3; j++) {
if (self[j] == all[i]) {
self[j] = null;
System.out.println("還書成功");
}
}
}
}
}

void have(Books[] self) {
// for (int i = 0; i < 2; i++) {
// self[i].showBookInfo();
// }
for (int i = 0; i < 3; i++) {
if(self[i]!=null)
self[i].showBookInfo();
}
}

void giveMoney() {

}

void borrowBooks(Books[] all, Books[] self) {
System.out.println("請輸入您要查找的書名:");
String n = scan.next();
int i;
for (i = 0; i < 10; i++) {
if (n.equals(all[i].name)) {
all[i].showBookInfo();
break;
}
}
//System.out.println("你要借嗎?");
System.out.println("你要借嗎?輸入1表示借,其他數(shù)字表示不借。");
int j;
j = scan.nextInt();
if (j == 1) {
System.out.println("借閱成功");
//self[score] = all[9];
self[score] = all[i];
score += 1;

}
if (score < 4) {
System.out.println("您還可以借閱" + (3 - score) + "本");
} else {
System.out.println("對不起,一個(gè)人只能借3本");
}
}
}

class Books {
String name;
int num;
String ISBN;
String writer;
float price;
String publisher;

Books(String n, int u, String i, String w, float p, String l) {
name = n;
num = u;
ISBN = i;
writer = w;
price = p;
publisher = l;
}

void showBookInfo() {
System.out.println("**************************");
System.out.println("書名:" + name);
System.out.println("索書號:" + num);
System.out.println("ISBN號:" + ISBN);
System.out.println("價(jià)格:" + price);
System.out.println("出版社:" + publisher);
System.out.println("**************************");
}

}

----------------------------------------------------

標(biāo)簽

相關(guān)資訊

我是中博奧客服:小奧
中博奧技術(shù)有限公司& 版權(quán)所有工信部備案號:豫ICP備11015869號-8 Copyright ? 2023-2024

檔案整理檔案數(shù)字化

檔案掃描檔案管理軟件系統(tǒng)

TEL:18937133779

To Top