내 문제는 파일 판독기로 고객 이름을 읽는 방법을 알 수없는입니다.파일 판독기를 사용하여 txt 파일에서 고객 이름 읽기
예약 시스템을 만들고 있는데 고객이 이미 있다는 것을 알아야합니다. 그래서 고객이 이미 고객인지 확인할 수 있도록 Customers.txt 파일을 읽어야합니다. 그가 아니라면 File writer (나는 이미 코드를 가지고있다.)와 함께 새로운 것을 만들 것이다.
이 예약 시스템의 의미는 이발소로 예약하는 것입니다. Reservations.txt라는 또 다른 txt 파일에 예약을 넣어야하고 그 파일에서 각 예약 시간과 누가 예약했는지 볼 수 있습니다.
도움 주셔서 감사합니다. (일부 의견이 네덜란드에 있지만 내가 그들을 변환합니다)
package nielbutaye;
import java.io.*;
import java.util.UUID;
/**
* @author Niel
*
*/
public class Klant {
//declaration that represents the text
public static String S;
public static String NEWLINE = System.getProperty("line.separator");
/**
* constructor
*/
public Klant(){}
/**
* @return
* By giving the name of the customer you will get all the data from the customer
*/
public double getCustomer() {
return 0 ;
}
/**
* Make a new customer
*/
public void setNew customer(){
// make a newSimpleInOutDialog
SimpleInOutDialog input = new SimpleInOutDialog("A new customer");
//input
S = "Name customer: " + input.readString("Give in your name:");
WriteToFile();
S = "Adress: " + input.readString("Give your adress");
WriteToFile();
S = "Telephonenummber: " + input.readString("Give your telephonenumber");
WriteToFile();
//making a customerID
UUID idCustomer = UUID.randomUUID();
S = "CustomerID: " + customerID.toString();
WriteToFile();
}
public void WriteToFile(){
try{
FileWriter writer = new FileWriter("L:\\Documents/Informatica/6de jaar/GIP/Customer.txt", true);
BufferedWriter out = new BufferedWriter(writer);
//Wrting away your data
out.write(S + NEWLINE);
//Closing the writer
out.close();
}catch (Exception e){//Catch when there are errors
System.err.println("Error: " + e.getMessage());
}
}
}
지금까지 가지고있는 코드를 게시 할 수 있습니까? – hmjd
@hmjd, 업데이트 된 질문 (: – PauloPawelo
자바 스크립트 태그 설명에서 "... 자바 스크립트와 다릅니다." –