KINGS OF IRAQ
اهلا وسهلا بكم في منتديات ملوك العراق
نتمنى منكم التسجيل في منتدياتنا
أدارة منتديات ملوك العراق
KINGS OF IRAQ
اهلا وسهلا بكم في منتديات ملوك العراق
نتمنى منكم التسجيل في منتدياتنا
أدارة منتديات ملوك العراق
KINGS OF IRAQ
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

KINGS OF IRAQ

منتديـــــــــ مــلـــــــــــ العراق ـــــــــــــوك ـــــــــــــــــــــــات
 
الرئيسيةأحدث الصورالتسجيلدخول
بحـث
 
 

نتائج البحث
 
Rechercher بحث متقدم
المواضيع الأخيرة
» طريقة صنع صفحات مزورة خاصة بك
java library writing to file Emptyالثلاثاء مايو 15, 2012 3:50 am من طرف hitler

» الكائنات المهددة بالانقراض
java library writing to file Emptyالأحد يوليو 17, 2011 4:13 pm من طرف متيكو المدير والمشرف

» تمساح ضخم.. جدا
java library writing to file Emptyالأحد يوليو 17, 2011 4:07 pm من طرف متيكو المدير والمشرف

» فتاة قامت باجراء عملية تحويل وجهها الى وجه خنزير
java library writing to file Emptyالأحد يوليو 17, 2011 3:58 pm من طرف متيكو المدير والمشرف

» ما تأثير أشعة الكمبيوتر على المخ ؟
java library writing to file Emptyالأحد يوليو 17, 2011 3:54 pm من طرف متيكو المدير والمشرف

» ماهو الارهاق ومتى نحتاج للراحة بصورة فعلية ؟
java library writing to file Emptyالأحد يوليو 17, 2011 3:48 pm من طرف متيكو المدير والمشرف

» أهم الصفات التى توقع الرجل فى حبك؛؛؛؛؛؛
java library writing to file Emptyالأحد يوليو 17, 2011 3:43 pm من طرف متيكو المدير والمشرف

» الــــــــــحـــــــــــــــب
java library writing to file Emptyالأحد يوليو 17, 2011 3:37 pm من طرف متيكو المدير والمشرف

» دروس في تصاميم الفوتوشوب
java library writing to file Emptyالأحد يوليو 17, 2011 3:32 pm من طرف متيكو المدير والمشرف


 

 java library writing to file

اذهب الى الأسفل 
كاتب الموضوعرسالة
متيكو المدير والمشرف
المدير العام

المدير العام
متيكو المدير والمشرف


java library writing to file 71507480py5
الجنس : ذكر الثعبان
عدد المساهمات : 590
تاريخ الميلاد : 02/11/1989
تاريخ التسجيل : 28/08/2009
العمر : 34
الموقع : www.matti-king.blogspot.com
العمل/الترفيه : يشرف عالمنتدى ويدرس
المزاج : تعبان

java library writing to file Empty
مُساهمةموضوع: java library writing to file   java library writing to file Emptyالجمعة مايو 27, 2011 2:25 pm

package app;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import library.Book;
import library.Magazine;
import library.Movie;
import library.Story;
import library.customer;

public class WriteTextFile
{
public static void addnewbook () throws NumberFormatException, IOException
{
System.out.println("which section your item belong to: 1-book " +" "+
"2-story" +" "+
"3-Magazine " +" "+
"4-movie" +" "+
"5-customer ");
BufferedReader userOption = new BufferedReader(new InputStreamReader(System.in));
float option = Float.parseFloat(userOption.readLine());
if (option == 1)
{
bookList(null);
}
else if (option == 2)
{
storyList(null);
}
else if(option==3)
{
magazineList(null);
}
else if(option==4)
{
movieList(null);
}
else if(option==5)
{
customers(null);
}
}
public static ArrayList<Book> bookList(Book[] myBooks)throws IOException
{

ArrayList <Book> bb=new ArrayList<Book>();
String fileName = "MyFile.txt" ;
FileWriter writer = new FileWriter( fileName, false);
PrintWriter out=new PrintWriter(writer);
System.out.println("to add new book fill the next form");
Scanner input=new Scanner(System.in);

String Name;
System.out.println("Enter your name");
Name=input.nextLine();
out.println(Name);


String isbn;
System.out.println("Enter the Isbn");
isbn=input.nextLine();
out.println(isbn);

String auther;
System.out.println("Enter the Auther");
auther=input.nextLine();
out.println(auther);

String title;
System.out.println("Enter the title");
title=input.nextLine();
out.println(title);

String type;
System.out.println("Enter the type");
type=input.nextLine();
out.println(type);

String edition;
System.out.println("Enter the Edition");
edition=input.nextLine();
out.println(edition);

String year_pubilsh;
System.out.println("Enter the Year of publish");
year_pubilsh=input.nextLine();
out.println(year_pubilsh);

String date_borrowed;
System.out.println("Enter the date of borrowed");
date_borrowed=input.nextLine();
out.println(date_borrowed);

out.close();
System.out.println("press 7 to back to the main minue");
bb.add(new Book(title, auther, type ,edition, year_pubilsh, date_borrowed));

return bb;

}
public static ArrayList<Story> storyList(Story[] myStory)throws IOException
{

ArrayList <Story> ss=new ArrayList<Story>();

String fileName = "MyFile.txt" ;
FileWriter writer = new FileWriter( fileName, false);
PrintWriter out=new PrintWriter(writer);
System.out.println("to add new book fill the next form");
Scanner input=new Scanner(System.in);

String title;
System.out.println("Enter the Title");
title=input.nextLine();
out.println(title);

String userNumber;
System.out.println("Enter the userNumber");
userNumber=input.nextLine();
out.println(userNumber);

out.close();
System.out.println("press 7 to back to the main minue");
ss.add(new Story(title, userNumber));
return ss;
}

@SuppressWarnings("unused")
public static ArrayList<Movie> movieList(Movie[] myMovie)throws IOException
{

ArrayList <Movie> mm=new ArrayList<Movie>();

Movie[] movies = new Movie[3];
String fileName = "MyFile.txt" ;
FileWriter writer = new FileWriter( fileName, false);
PrintWriter out=new PrintWriter(writer);
System.out.println("to add new book fill the next form");
Scanner input=new Scanner(System.in);
String Name;
System.out.println("Enter the Name");
Name=input.nextLine();
out.println(Name);

String Genre;
System.out.println("Enter the Genre");
Genre=input.nextLine();
out.println(Genre);

String Director;
System.out.println("Enter the Director");
Director=input.nextLine();
out.println(Director);
String Writer;
System.out.println("Enter the Writer");
Writer=input.nextLine();
out.println(Writer);

String Producer;
System.out.println("Enter the Producer");
Producer=input.nextLine();
out.println(Producer);
String Language;
System.out.println("Enter the Language");
Language=input.nextLine();
out.println(Language);

String Country;
System.out.println("Enter the Country");
Country=input.nextLine();
out.println(Country);

String Year_of_produce;
System.out.println("Enter the Year_of_produce");
Year_of_produce=input.nextLine();
out.println(Year_of_produce);

out.close();
System.out.println("press 7 to back to the main minue");
mm.add(new Movie(Name,Genre,Director,Writer,Producer,Language,Country,null));
return mm;
}
@SuppressWarnings("unused")
public static ArrayList<Magazine> magazineList(Magazine[] myMagazine)throws IOException
{
ArrayList <Magazine> ma=new ArrayList<Magazine>();

Magazine[] magazine = new Magazine[2];
String fileName = "MATTI.txt";
FileWriter writer = new FileWriter( fileName, false);
PrintWriter out=new PrintWriter(writer);
System.out.println("to add new book fill the next form");
Scanner input=new Scanner(System.in);

String title;
System.out.println("Enter the Title");
title=input.nextLine();
out.println(title);

String userNumber;
System.out.println("Enter the userNumber");
userNumber=input.nextLine();
out.println(userNumber);

out.close();
System.out.println("press 7 to back to the main minue");
ma.add(new Magazine(title, userNumber));
return ma;
}
@SuppressWarnings("unused")
public static ArrayList<customer> customers(customer[] mycustomer)throws IOException
{

ArrayList <customer> cc=new ArrayList<customer>();

customer[] customers = new customer[3];
String fileName = "MyFile.txt" ;
FileWriter writer = new FileWriter( fileName, false);
PrintWriter out=new PrintWriter(writer);
System.out.println("to add new book fill the next form");
Scanner input=new Scanner(System.in);
String firstName;
System.out.println("Enter the firstName");
firstName=input.nextLine();
out.println(firstName);
String lastName;
System.out.println("Enter the lastName");
lastName=input.nextLine();
out.println(lastName);
String birthday;
System.out.println("Enter the birthday");
birthday=input.nextLine();
out.println(birthday);
int phone_number;
System.out.println("Enter the phone_number");
phone_number=input.nextInt();
out.println(phone_number);
System.out.println("press 7 to back to the main minue");
cc.add(new customer(firstName , lastName , null, phone_number));
out.close();
return cc;



}

}
الرجوع الى أعلى الصفحة اذهب الى الأسفل
https://kings4u.ahlamontada.com
 
java library writing to file
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
KINGS OF IRAQ :: منتدى الكمبيوتر :: قسم تعلم لغات البرمجة-
انتقل الى: