الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مهم جداً :كيف تتم كتابة هذا الكود

بدأه حاتمكو في 10 مايو 2008 · 7 رد · 1,007 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Project topic: Library System

Project requirements: (please read thoroughly, NO excuse)

· Load a list of available books from the text file “books.txt” (file is given) into an ArrayList. File format is as follows:

978-0-13-197629-0 Object First with Java 2003

Where: 978-0-13-197629-0 is ISBN No, "Object First with Java" is the book title, and 2003 is the publishing year.

· Load a list of members from the text file “Members.txt” (file is given) into an ArrayList. File format is as follows:

Salem Ali 200512345 St IS

Where: Salem is the first name, Ali is second name, 200512345 is the member id, St is the member type (St: Student, Ft: Faculty member), IS the member major.

· Display the following menu:

1 - Select a library member.

2 - List all members

3 - List all books in the Library

4- List borrowed books

0 - Exit

Select one of the above numbers (0-4):

· When 1 is selected, list all library members and ask user to select one.

· When a library member is selected, display the following menu:

1 – Borrow a book

2 – Return a book

3 - List member’s borrowed books *

0 - Return to main menu

Select one of the above numbers (0-3):

The above commands act based on the selected option.

See the program RUN below and let your program work like it.

Important Notes: please read

- This project is from 10 marks.

- Your program must use one inheritance and at least 4 classes (Member, Book,

FileReader, Test class and one class to inherit from).

- Use the LogFileReader of the weblog-analyzer project and customize it as needed to

read books and member files.

- Make sure you have a class named Test. Also, make sure you write a main () method

inside it. I am going to compile and run this class only.

- Your program must accept input and display output exactly as shown in the

program run below. Same sequence is required. I am going to use automated

input to test your program. If your program fails the automated test you loose directly

2 marks.

- Submit your own program. Duplicates will get zero (the author and the copier). It is your

responsibility to protect your work. Delete your project from lab computers after every session.

- You must submit your project by 14:30, Thursday, May 15th, 2008.

- To submit your work, do the following:

- On your computer, create a folder with a name equal to your student’s ID + your name

(DO NOT name it PROJECT). If name is not as specified, you loose 2 marks.

- Put all your source files (.java) inside that folder.

- Use WinZip or Winrar to compress your folder and create one file that has the same

Name of your folder. Check the contents of your compressed file before submitting it. No

files, no mark.

- Submit your compressed file through the MOODLE system. I will add project entry.

Use this main function in your Test class:

Public static void main (String [] arg)

{

Test t = new Test();

t.start ();

}

Below is a program run. Make sure your program runs exactly like this:

C: \Salahat> java Test

1 - Select a library member

2 - List all members

3 - List all books in the Library

4 - List borrowed books

0 - Exit

Select one of the above numbers (0-4): 2

0 Mohd Salahat 4230102-I Ft IS

1 Mahmoud Ahmed 200110229 St CS

2 Seyed Salim 2737102-A Ft CE

3 Salem Ali 200512345 St IS

4 Arash Yousef 200220204 St CE

1 - Select a library member

2 - List all members

3 - List all books in the Library

4 - List borrowed books

0 - Exit

Select one of the above numbers (0-4): 3

0 978-0-13-197629-0 Object First with Java 2003 Available

1 020-1-20-231023-0 C++ Deitel Deitel 2005 Available

2 029-2-93-291902-1 Java Programming 1998 Available

3 213-5-42-315643-2 UNIX Concepts Ed4 1995 Available

4 242-2-13-423412-3 Database Management 2007 Available

1 - Select a library member

2 - List all members

3 - List all books in the Library

4 - List borrowed books

0 - Exit

Select one of the above numbers (0-4): 1

0 Mohd Salahat 4230102-I Ft IS

1 Mahmoud Ahmed 200110229 St CS

2 Seyed Salim 2737102-A Ft CE

3 Salem Ali 200512345 St IS

4 Arash Yousef 200220204 St CE

Select one of the above numbers (0-4): 0

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 1

0 978-0-13-197629-0 Object First with Java 2003 Available

1 020-1-20-231023-0 C++ Deitel Deitel 2005 Available

2 029-2-93-291902-1 Java Programming 1998 Available

3 213-5-42-315643-2 UNIX Concepts Ed4 1995 Available

4 242-2-13-423412-3 Database Management 2007 Available

Select one of the above numbers (0-4): 0

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 1

0 978-0-13-197629-0 Object First with Java 2003 Not Available

1 020-1-20-231023-0 C++ Deitel Deitel 2005 Available

2 029-2-93-291902-1 Java Programming 1998 Available

3 213-5-42-315643-2 UNIX Concepts Ed4 1995 Available

4 242-2-13-423412-3 Database Management 2007 Available

Select one of the above numbers (0-4): 1

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 2

0 Object First with Java

1 C++ Deitel Deitel

Select one of the above numbers (0-1): 0

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 3

0 C++ Deitel Deitel

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 1

0 978-0-13-197629-0 Object First with Java 2003 Available

1 020-1-20-231023-0 C++ Deitel Deitel 2005 Not Available

2 029-2-93-291902-1 Java Programming 1998 Available

3 213-5-42-315643-2 UNIX Concepts Ed4 1995 Available

4 242-2-13-423412-3 Database Management 2007 Available

Select one of the above numbers (0-4): 1

Sorry, the requested book is not available

1 – Borrow a book

2 – Return a book

3 - List member's borrowed books

0 - Return to main menu

Select one of the above numbers (0-3): 0

1 - Select a library member

2 - List all members

3 - List all books in the Library

4 - List borrowed books

0 - Exit

Select one of the above numbers (0-4): 0

*********************************

Thanks for using this program

*********************************

#2

حاتمكو اهلا وسهلا بك

البرنامج بسيط ومشروح بطريقه رائعه

فقط تعلم كيف تقرأ من ملف وكيف تقوم باستخدام switch & if statement

وحاول وارفق محاولتك

#3

hii

lek ana 2asfe low ba3ref el 7al kent a3tetak eyah bas walla ma ba3ref

leek btmana 7ada y7elo ana bade el 7al bfedne la ba3den

ma 7ada 2ader y7elo hoon !!!!!!!

inshalla bshoflak rfe2te inshalla bta3ref t7elo o b7kelak

nyway thnx every1

#4

يالله على يدك يامريم

عطينا محاولاتك ونعطيك الحل

#5

hay ma7awalte bel bluej 3melet lal files compress

inshalla ykon 7ada 3ando el 7al

thnx 4 all

maryoom_java.zip

#6

ممكن حد يحكيلي كيف تتم القراءه من الملف ?

thnx

#7

ابحثي في المنتدى

هناك الكثير تكلموا عن ذلك

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#8

i tried alot of times to solve it i dont know how!!

this is the code

:

import java.io.File;

import java.io.*;

import java.io.FileNotFoundException;

import java.net.URISyntaxException;

import java.net.URL;

import java.util.ArrayList;

import java.util.Collections;

import java.util.Iterator;

import java.util.Random;

import java.util.Scanner;

import java.util.*;

public class members

{

private String fname="members.txt";

public ArrayList readFile(String fname)

{

String line;

StringBuffer sb = new StringBuffer();

ArrayList al = new ArrayList();

try {

FileInputStream fis = new FileInputStream(fname);

BufferedReader reader=

new BufferedReader

(new InputStreamReader(fis));

while((line = reader.readLine()) != null)

{

al.add(line);

}

reader.close();

}

catch (IOException e) {

System.err.println("*** IOexception ***" + e.getMessage());

}

return al;

}

public void listmembers(String al)

{

while(al!=null)

{

System.out.println(al);

}

}

}

مواضيع مشابهة