Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- JavaScript
- javscript
- Emit
- axios
- programmers
- includes
- Reduce
- getters
- Login
- kibana
- javascipt
- IntelliJ
- state
- KAKAO
- 연동
- vuex
- Vue.js
- react
- node.js
- v-on
- 템플릿문법
- azure
- Express.js
- v-if
- v-for
- 음양더하기
- mixins
- sns로그인
- mutations
- 콘솔한글깨짐
Archives
- Today
- Total
공부용
결제 본문
휴대폰 결제
Scanner scan = new Scanner(System.in);
System.out.print("\t\t카드 번호를 '-'없이 입력하세요 : ");
String cardNum = scan.nextLine();
System.out.print("\t\t카드 비밀번호를 입력하세요 : ");
String cardPw = scan.nextLine();
System.out.print("\t\t카드사를 입력하세요 : ");
String cardCorp = scan.nextLine();
System.out.print("\t\t유효기간을 입력하세요 : ");
String cardExp = scan.nextLine();
CardInfo cardInfo = new CardInfo(cardNum, cardPw, cardCorp, cardExp);
boolean bool = isValidCard(cardInfo);
if(bool) { //카드 등록
try {
Path path = new Path();
String readPath = path.userPath + "userCard\\"+id+".txt";
BufferedWriter writer = new BufferedWriter(new FileWriter(readPath));
writer.write(cardNum+"■"+cardPw+"■"+cardCorp+"■"+cardExp);
writer.close();
} catch (Exception e) {
System.out.println("Payment.inputCardInfo()");
e.printStackTrace();
}
return;
}
else {
System.out.println("\t\t\t카드정보를 다시 입력해주세요.");
inputCardInfo(id);
}
카드 결제
Path path = new Path();
String readPath = path.userPath + "userCard\\" + id + ".txt";
try {
BufferedReader reader = new BufferedReader(new FileReader(readPath));
line = "";
line = reader.readLine(); // 카드정보 불러옴!
String[] cardInfo = line.split("■");
reader.close();
scan.nextLine(); //엔터키 버퍼제거
System.out.println("\t\t\t카드 번호 : " + cardInfo[0]);
System.out.println("\t\t\t카드 비밀번호를 입력하세요");
System.out.print("\t\t\t입력 : ");
String cardPw = scan.nextLine();
if(cardInfo[1].equals(cardPw)) {
System.out.println("\t\t\t결제가 완료됐습니다.");
}
else {
System.out.println("\t\t\t입력된 정보가 다릅니다.");
payCard(id);
}
'2020.10 ~ 2021.03 취업성공패키지 > 영화관 관리(Java)' 카테고리의 다른 글
메모장에 예약된 자리 바꾸기 (0) | 2021.01.27 |
---|---|
좌석선택 (0) | 2021.01.20 |
영화관 선택 (0) | 2021.01.20 |
영화 선택 (0) | 2021.01.20 |
로그인 (0) | 2021.01.17 |
Comments