عندي مشروع بسيط لنظام مكتبه كلاسات مرتبطه في بكج واحد
المطلوب\\
The idea of the project is to create a very simple library system. that allows students to borrow books and return it within given date .
You are required to write these classes :
1-class Person with these data members :
Name ,Date of birth (date),Sex (char).
Methods:
ToSrting : to print the person information.
2-class student:
Name ,Date of birth (date),Sex (char),ID (string ), Specialty(string),and a list of borrowed books .
Methods:
ToSrting : to print the student’s information.
addBook:to add a borrowed book.
ListOfBooks: to print the list of borrowed books.
3-class Book :
title (string), book no(string),author(string), Specialty(string), edition(string),borrowed or not (Boolean).
Methods:
ToSrting : to print the book’s information.
4-class Author :
name ,date of birth, sex, list of books.
Methods:
ToSrting : to print the author’s information.
PrintList: to print the author’s book
5-Borrwo interface :
Void Borrow(string bookno);
Void printreport(student s,list of book).
(You must determine which classes must implement this interface ).
The main should allow the user:
1-Adding new books to the library .
2- Loaning books to new students
3- Printing the list of b books of any author.
4-Printing the list of borrowed books of any student .
5- Printing the list of b books in a specific topic .
6- Bonus :Printing a report after every Loan Process including :
The current data ,
Student name , id
Book no ,name ,edition
determine the returning date “1 month “.
· You should add all the needed setter and getter methods and constructors.
· You should also override the methods equals, and toString wherever they are
needed.
· Write the class diagram ,and the sequence diagram for all classes.
اولا class Person
package person;
import java.util.Date;
/**
*
* @author hams4242
*/
public class Person {
String name;
Date date;
char sex;
public void setName(String name) {
this.name = name;
}
public void setDate(Date date) {
this.date = date;
}
public void setSex(char sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public Date getDate() {
return date;
}
public char getSex() {
return sex;
}
@Override
public String toString() {
return "Person{" + "name=" + name + ", date=" + date + ", sex=" + sex + '}';
}
}ثانيا class student
public class Student {
String name;
Date date;
char sex;
String ID;
String Specialty;
Vector<Student> ListOfBookBorrowed;
public void setName(String name) {
this.name = name;
}
public void setDate(Date date) {
this.date = date;
}
public void setSex(char sex) {
this.sex = sex;
}
public void setID(String ID) {
this.ID = ID;
}
public void setSpecialty(String Specialty) {
this.Specialty = Specialty;
}
public void setListOfBookBorrowed(Vector<Student> ListOfBookBorrowed) {
this.ListOfBookBorrowed = ListOfBookBorrowed;
}
public String getName() {
return name;
}
public Date getDate() {
return date;
}
public char getSex() {
return sex;
}
public String getID() {
return ID;
}
public String getSpecialty() {
return Specialty;
}
public Vector<Student> getListOfBookBorrowed() {
return ListOfBookBorrowed;
}
@Override
public String toString() {
return "Student{" + "name=" + name + ", date=" + date + ", sex=" + sex + ", ID=" + ID + ", Specialty=" + Specialty + ", ListOfBookBorrowed=" + ListOfBookBorrowed + '}';
}
public void addBook(){
}
}لكن ماعرفت للميثود addBook ,ListOfBook
ثالثا class book
public class Book {
String title,book ,author, Specialty, edition;
Boolean borrowed;
public void setTitle(String title) {
this.title = title;
}
public void setBook(String book) {
this.book = book;
}
public void setAuthor(String author) {
this.author = author;
}
public void setSpecialty(String Specialty) {
this.Specialty = Specialty;
}
public void setEdition(String edition) {
this.edition = edition;
}
public void setBorrowed(Boolean borrowed) {
this.borrowed = borrowed;
}
public String getTitle() {
return title;
}
public String getBook() {
return book;
}
public String getAuthor() {
return author;
}
public String getSpecialty() {
return Specialty;
}
public String getEdition() {
return edition;
}
public Boolean isBorrowed() {
return borrowed;
}
@Override
public String toString() {
return "Book{" + "title=" + title + ", book=" + book + ", author=" + author + ", Specialty=" + Specialty + ", edition=" + edition + ", borrowed=" + borrowed + '}';
}
}رابعا Authorclass
package author;
import java.util.Date;
import java.util.Vector;
/**
*
* @author hams4242
*/
public class Author {
String name;
Date birth;
char sex;
Vector<Author> ListOfBook;
public void setName(String name) {
this.name = name;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public void setSex(char sex) {
this.sex = sex;
}
public void setListOfBook(Vector<Author> ListOfBook) {
this.ListOfBook = ListOfBook;
}
public String getName() {
return name;
}
public Date getBirth() {
return birth;
}
public char getSex() {
return sex;
}
public Vector<Author> getListOfBook() {
return ListOfBook;
}
@Override
public String toString() {
return "Author{" + "name=" + name + ", birth=" + birth + ", sex=" + sex + ", ListOfBook=" + ListOfBook + '}';
}
}كمان ماعرفت للميودPrintList: to print the author’s book
والكلاس الاخير Borrwo interface
ماعرفته اضافه للمين
ارجووو المساعده وتصحيح اخطائي
دمتم بود