![]() |
|
|||||||
| Kayıt ol | Yardım | Üye Listesi | Ajanda | Arama | Bugünki Mesajlar | Bütün Forumları okunmuş kabul et |
| Java Java Hakkında Aradığınız Herşey.. Java Kodları.. |
![]() |
|
|
LinkBack | Seçenekler |
|
|
#1 (permalink) | ||
|
Mesajlar: n/a
|
//CallControl.java //KAYWINSOFT package telephone; import javax.swing.*; public class CallControl { boolean checkAvailability() { JOptionPane.showMessageDialog(null,"Telephone Numbers Simulation","KAYWINSOFT", JOptionPane.INFORMATION_MESSAGE); double random = 0; for(int i = 0; i<10 ; i++) random = 5 + Math.random() % 100; return random>5?true:false; } void areaCodeCheckList() { JOptionPane.showMessageDialog(null,"Telephone Numbers Simulation","KAYWINSOFT", JOptionPane.INFORMATION_MESSAGE); FileInput info = new FileInput(); info.areaCode(); } void getting(String number) { FileInput info = new FileInput(); info.getNumber(number); } void showing() { FileInput info = new FileInput(); info.showNumber(); } } //FileInput.java //KAYWINSOFT package telephone; /** * This program reads a text file line by line and print to the console. It uses * FileOutputStream to read the file. * */ import java.io.*; public class FileInput extends CallControl { public void areaCode(){ try { BufferedReader in; in = new BufferedReader(new FileReader("telephone\\AreaCode.txt")); // dosya bir stream halinde alınır String str; // döngü içerisinde satır satır okunur. while ((str = in.readLine()) != null) System.out.println(str); // başta açılan stream kapatılır in.close();} catch (IOException e){ System.out.println("Hata oluştu."); } }//end areaCode public void getNumber(String number) { try { FileWriter yaz; yaz = new FileWriter("telephone\\User.txt"); PrintWriter okut; okut = new PrintWriter(yaz); okut.write(number); yaz.close(); }//end try catch(IOException e) { System.out.println("An error has occured"); }//end catch }//end getNumber public void showNumber() { try { BufferedReader yaz; yaz = new BufferedReader(new FileReader("telephone\\User.txt")); String str; // döngü içerisinde satır satır okunur. while ((str = yaz.readLine()) != null) System.out.println(str); // başta açılan stream kapatılır yaz.close();} catch (IOException e){ System.out.println("Hata oluştu."); } }//end showNumber }//end class FileInput //TelephoneTest.java //KAYWINSOFT package telephone; import javax.swing.*; public class TelephoneTest { public static void main(String[] args) { // TODO Auto-generated method stub String gets; CallControl sub = new CallControl(); boolean checks; checks = sub.checkAvailability(); if(checks){ sub.areaCodeCheckList(); gets = JOptionPane.showInputDialog("Please Enter the phone number"); sub.getting(gets); sub.showing(); }//end if else { System.out.println("The server is unavaiable , Please try again later"); System.exit(0); }//end else }//end main } |
||
|
![]() |
| Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir) | |
| Seçenekler | |
|
|
Benzer Konular
|
||||
| Konu | Konuyu Başlatan | Forum | Cevaplar | son Mesaj |
| Wocsoft Telefon Defteri 1.2B | Jack | Program Arşivi ve Türkçe Yamalar | 0 | 01-02-08 22:10 |
| Wocsoft Telefon Defteri 1.2B | Jack | Program Arşivi ve Türkçe Yamalar | 0 | 01-02-08 13:40 |
| Gül'den tanıdıklara sürpriz telefon | Cansu | Gündem | 0 | 12-30-07 16:10 |
| Hem fatura hem de telefon bedava! | DeviL | Son Dakika Haber | 0 | 12-29-07 12:40 |
| 2007 nin en harika telefon sakasi | C_a_n | Komik Videolar | 1 | 12-23-07 00:56 |
mirc
mırc
çet
cet
sohbet
chat
canlı tv