السلام عليكم
انا عندي assignment عليها 50% من الدرجات الكليه ولازم اجيب فيها على الاقل 30%
المشروع باختصار مكتبه وفيها اعضاء(HashMap) و كتالوج للكتب يشمل معلومات الكتب(ArrayList) وكتب موجوده في المكتبه (Hashmap)
اي كتاب جديد يصدر يضاف اللي الكتالوج ولما يصل المكتبه يضاف للكتب الموجوده في المكتبه.
اي عضو يسمح له باستعارة 6 كتب على الاكثر
مدة اعارة اي كتاب 28 يوم ولو تاخر عليه بدفع 20 بنس عن كل يوم تاخير
هذا المشروع باختصار
انا جديد في الجافا وعندي مشاكل مع الHasMap لو احد ممكن يساعدني ويعلمني كيف اعمل هاش ماب لل Members and books
اتمنى تطلعوا عليه وايه مساعده مهما كانت بسيطه او اي اقتراح حاكون سعيد
التسليم يوم الثلاثاء الجاي وانا والله ماني قادر اسوي اي شي
انا شغال على BlueJ
بس لو كتبها ع ال java مو مشكله انا احولها لل bluej
اللي معقدني كيف اسوي HashMap لل Member and Books on shelf
وكيف بعد ما اعمل ماب للاعضاء كيف اضيف لكل عضو الكتب اللي حيستعيرها من المكتبه
رابط ال assignment
http://www.filefactory.com/file/f7d5f9/
مستعد لدفع مقابل مادي لاي مساعده اذا طلب
اللي عملته لحد الان:
import java.util.ArrayList;
import java.util.HashMap;
/**
* Write a description of class Library here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Library
{
private ArrayList<Book> bk;
private HashMap<Member , Member> memb;
// i coudnt make the HashMap here.
private HashMap<Book , Book> stock;
public Library ()
{
bk = new ArrayList<Book>();
memb = new HashMap<Member, Member>();
stock = new HashMap<Book, Book>();
}
// to add a book to the catalogue (the book information)
public void newBook(Book B)
{
bk.add(B);
}
public void TheStateOfTheLibrary()
{
//print the library name and address
System.out.println("BlueJ Library: 10 College Lane, AL10 9BL");
// print list of the books (title, author, ISBN)
System.out.println("Catalogue :");
for (Book b : bk){
System.out.println(B);
}
System.out.println("");
/**
* print stock list to show all stocks in the library
*stock number, book, name, thuthor and ISBN
*/
System.out.println("Stock List:");
System.out.println("");
// Print Members List
System.out.println("Members List:");
}
public void addMember(Member mn, Member m)
{
String key = mn.getmembershipNumber();
memb.put(key, m.Member);
}
// to add a copy of a book to it's stock, when the library receives this item.
public void addBookToStock(Book sn)
{
stock.put(Book.getStockNumber, sn.Book);
}
}
/**
* Write a description of class library here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Book
{
private String title;
private String author;
private String ISBN;
private int quantity;
private int stockNumber;
public Book(String title, String author, String ISBN)
{
this.title = title;
this.author = author;
this.ISBN = ISBN;
quantity = 0;
//stock number satrts from 2000
stockNumber = 1999;
}
//to add quantity when a book reseives.
public int addquntity ()
{
quantity ++;
return quantity;
}
public int getQuantity()
{
return quantity;
}
// chang the quantity when costumer borrows a book from the library
public int borrowBook()
{
if(quantity > 0){
quantity --;
}
else{
System.out.print("sorry the book is not available");
}
return quantity;
}
// chang the quantity when the library recieves or a costumer rturnes a book
public void deliverBookBack()
{
quantity++;
}
public String toString()
{
return title + " by " + author + ". ISBN = " + ISBN ;
}
// change the stock number after adding any book to its stock in the library
public int autoStockNumber()
{
stockNumber ++;
return stockNumber;
}
public int getStockNumber()
{
return stockNumber;
}
}
/**
* Write a description of class members here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Member
{
private String name;
private String address;
private String membershipNumber;
public Member(String name, String address, String membershipNumber)
{
this.name = name;
this.address = address;
this.membershipNumber = membershipNumber;
}
public String getmembershipNumber()
{
return membershipNumber;
}
public String toString()
{
return membershipNumber + ": " + name +
address;
}
}
اذا في شي غلط علموني عشان اعدل
تحياتي