Warning: Use of undefined constant memo - assumed 'memo' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 278
홍차넷
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 34
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 45
Warning: Use of undefined constant r - assumed 'r' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 47
Warning: Use of undefined constant r - assumed 'r' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 51
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 34
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 45
Warning: Use of undefined constant r - assumed 'r' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 47
Warning: Use of undefined constant r - assumed 'r' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/outlogin_toby.php on line 51
Warning: Use of undefined constant is_admin - assumed 'is_admin' (this will throw an Error in a future version of PHP) in /home/redtea/html/zero_header.php on line 269
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/zero_header.php on line 300
Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/bbs_title.php on line 16
질문
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/bbs_title.php on line 21
Warning: Use of undefined constant header - assumed 'header' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/bbs_title.php on line 31
- 질문 게시판입니다.
Warning: Use of undefined constant use_formmail - assumed 'use_formmail' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 519
Warning: Use of undefined constant use_category - assumed 'use_category' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/include/print_category.php on line 9
전체기타게임진로연애가정/육아체육/스포츠교육의료/건강철학/종교IT/컴퓨터여행과학문화/예술법률홍차넷경제
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/setup.php on line 29
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/setup.php on line 41
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 398
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant subject - assumed 'subject' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 402
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 403
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 405
Warning: Use of undefined constant total_comment - assumed 'total_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 406
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 2
Warning: Use of undefined constant HTTP_HOST - assumed 'HTTP_HOST' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/memo_replace.php on line 3
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 10
Warning: Use of undefined constant use_category - assumed 'use_category' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 40
Date |
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 53 17/10/19 15:33:52 Warning: Use of undefined constant mod_date - assumed 'mod_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 56 |
Name | 二ッキョウ니쿄 |
Subject | 자바 질문입니다 |
package com.ex11market; [메인클래스] public class MarketMain { static Goods[] g = { new Goods("g01", "레쓰비", 25, 900), new Goods("g02", "박카스", 25, 700), new Goods("g03", "ABC초콜릿", 25, 1600), new Goods("g04", "크리넥스", 25, 2000), new Goods("g05", "전자담배", 25, 90000) }; static Customer[] c = { new Customer("010-1111-1111", "서울이", "10-10"), new Customer("010-1212-1212", "고려놈", "10-18"), new Customer("010-1313-1313", "연세놈", "01-11"), new Customer("010-1414-1414", "서강이", "02-27"), new Customer("010-1515-1515", "세종이", "06-30") }; public static void main(String[] args) { sell("g05", "1515", 3); sell("g02", "1212", 5); } private static void sell(String gCode, String subTel, int su) { int i, gIndex, cIndex; for (i = 0; i < g.length; i++) { if (g[i].getgCode().equals(gCode)) { break; } } if (i == g.length) { System.out.println("상품코드가 잘못 되었습니다"); return; } gIndex = i; // 상품이 가르키는 곳의 인덱스 for (i = 0; i < c.length; i++) { String tel = c[i].getTel();// 010-9999-9999 if (tel.substring(9).equals(subTel)) { break; } } if (i == c.length) { System.out.println("전화번호가 잘못 되었습니다. 회원가입하시죠"); return; } cIndex = i; // 고객을 가르키는 곳의 인덱스 int tempSu = g[gIndex].getStock() - su; if (tempSu < 0) { System.out.println("재고량이 부족합니다. 죄송합니다."); System.out.println("사장님!" + g[gIndex].getgName() + "얼른 주문하세요"); return; } g[gIndex].setStock(tempSu); String gName = g[gIndex].getgName(); int price = g[gIndex].getPrice(); c[cIndex].buy(gName, price, su); } } [상품클래스] public class Goods { private String gCode; private String gName; private int stock; private int price; public Goods() { } public Goods(String gCode, String gName, int stock, int price) { this.gCode = gCode; this.gName = gName; this.stock = stock; this.price = price; } public String getgCode() { return gCode; } public void setgCode(String gCode) { this.gCode = gCode; } public String getgName() { return gName; } public void setgName(String gName) { this.gName = gName; } public int getStock() { return stock; } public void setStock(int stock) { this.stock = stock; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } } [고객클래스] import java.text.SimpleDateFormat; import java.util.Date; public class Customer { private String tel; private String cName; private int money; private int point; private String birth; private boolean vip; public Customer() { } public Customer(String tel, String cName, String birth) { this.tel = tel; this.cName = cName; this.birth = birth; money = 0; point = 0; } public void changedTel(String cName,String tel) { this.tel = tel; } public void buy(String gName, int price, int su) { if(price<0) { System.out.println("구매금액이 잘못되었습니다"); return; } money += price*su; int thispoint = (int)(price*su*0.1); point += thispoint; if(money>=1000000 && vip == false) { vip = true; System.out.println("vip가 되셨습니다"); } msgBirth(); System.out.println(gName+""+su+"개 *"+price+"원 = "+(price*su)); System.out.println("이번 누적 포인트는 "+thispoint+"원 입니다"); System.out.println(cName+"고객님 포인트 합계 : "+point+"원"); System.out.println("★ ★ ★ 감 사 합 니 다 ★ ★ ★"); } public void msgBirth() { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MM-dd"); String today = sdf.format(now); if(birth.equals(today)) { System.out.println(cName+"님 생일 축하드립니다"); point+=3000; System.out.println("생일 기념으로 3000포인트가 적립됩니다"); } } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getcName() { return cName; } public void setcName(String cName) { this.cName = cName; } public int getMoney() { return money; } public void setMoney(int money) { this.money = money; } public int getPoint() { return point; } public void setPoint(int point) { this.point = point; } public String getBirth() { return birth; } public void setBirth(String birth) { this.birth = birth; } public boolean isVip() { return vip; } public void setVip(boolean vip) { this.vip = vip; } } [콘솔창 결과물] 전자담배3개 *90000원 = 270000 이번 누적 포인트는 27000원 입니다 세종이고객님 포인트 합계 : 27000원 ★ ★ ★ 감 사 합 니 다 ★ ★ ★ 박카스5개 *700원 = 3500 이번 누적 포인트는 350원 입니다 고려놈고객님 포인트 합계 : 350원 ★ ★ ★ 감 사 합 니 다 ★ ★ ★ 안녕하세요 자바 4주차 공부중인 코린이입니다. 슈퍼마켓에서 배열등을 이용해 콘솔창에서 물건을 사고 재고랑 가격, 포인트 등을 만드는 코드를 짰는데요 제가 배운 영역에서 어떻게 더 리팩토링해서 보기 좋고 더 나은 ? 상태로 만들어야 할지 더 알수가 없어서 질문드립니다. 혹시 어떤식으로 고치는게 좋을까요? 제반지식은 본문에 쓰인 코드랑 싱글턴, 스트레터지 패턴, 대표적인 api 몇가지랑 추상화,인터페이스, 상속, 접근제한자 및 기본적인 변수 연산자 제어문 배열정도입니다.. 깔끔하게 올릴 방법을 몰라서 이렇게 올리는데 도움 주시면 감사드리겠습니다. Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 133 Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 146 Warning: Use of undefined constant vote - assumed 'vote' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view.php on line 161 0 이 게시판에 등록된 二ッキョウ니쿄님의 최근 게시물
|
Warning: Use of undefined constant memo - assumed 'memo' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 185
Warning: Use of undefined constant use_comment - assumed 'use_comment' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 540
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 542
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 543
Warning: Use of undefined constant memo - assumed 'memo' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 545
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 576
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 577
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 577
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 577
Warning: Use of undefined constant grant_delete - assumed 'grant_delete' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 577
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 425
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 429
Warning: Use of undefined constant use_formmail - assumed 'use_formmail' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 605
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 599
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 599
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 600
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 600
Warning: Use of undefined constant is_admin - assumed 'is_admin' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 605
Warning: Use of undefined constant is_admin - assumed 'is_admin' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 605
Warning: Use of undefined constant is_admin - assumed 'is_admin' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 609
Warning: Use of undefined constant is_admin - assumed 'is_admin' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 609
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 614
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 616
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 618
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/lib.php on line 618
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 612
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 612
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 620
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 628
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 628
Warning: Use of undefined constant HTTP_HOST - assumed 'HTTP_HOST' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 640
Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 644
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 646
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/view.php on line 646
Warning: Use of undefined constant HTTP_HOST - assumed 'HTTP_HOST' (this will throw an Error in a future version of PHP) in /home/redtea/html/pb/cmt_replace.php on line 3
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 6
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 22
Warning: Use of undefined constant file_name - assumed 'file_name' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 28
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 65
30407 class="iamcmt" style="display:none;"> Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 66
30407 class='vcm '>
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 70
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 71
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 76
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 117
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 118
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 119
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 120
Warning: Use of undefined constant ismember - assumed 'ismember' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 121

30407'> 유리소년
Warning: Use of undefined constant mod_date - assumed 'mod_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 133
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 134
수정됨
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 140
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 140
Warning: Use of undefined constant reg_date - assumed 'reg_date' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 142
17/10/19 17:33
30407>삭제 주소복사
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 150
간단한 프로그램이라 리팩토링할 거리가 별로 없어보이기는 하는데
1) 변수명..
private static void sell(String gCode, String subTel, int su) {
이런식으로 쓰지 마시구요
private static void sellGoods(String goodsCode, String lineNumber, int buyingCount)
리팩토링은 함수명 변수명만 잘지어도 반은 먹고들어갑니다.
2)
int i, gIndex, cIndex;
for (i = 0; i <... 더 보기
1) 변수명..
private static void sell(String gCode, String subTel, int su) {
이런식으로 쓰지 마시구요
private static void sellGoods(String goodsCode, String lineNumber, int buyingCount)
리팩토링은 함수명 변수명만 잘지어도 반은 먹고들어갑니다.
2)
int i, gIndex, cIndex;
for (i = 0; i <... 더 보기
간단한 프로그램이라 리팩토링할 거리가 별로 없어보이기는 하는데
1) 변수명..
private static void sell(String gCode, String subTel, int su) {
이런식으로 쓰지 마시구요
private static void sellGoods(String goodsCode, String lineNumber, int buyingCount)
리팩토링은 함수명 변수명만 잘지어도 반은 먹고들어갑니다.
2)
int i, gIndex, cIndex;
for (i = 0; i < g.length; i++) {
if (g[i].getgCode().equals(gCode)) {
break;
}
}
if (i == g.length) {
System.out.println("상품코드가 잘못 되었습니다");
return;
}
gIndex = i; // 상품이 가르키는 곳의 인덱스
이렇게 하지 마시고.. for문 iterator로 쓰는 변수를 for문 밖에서 쓰는건 좋은 습관은 아니에요.
아마 문제에서 번호가 겹치는 데이터가 2개 이상 있지는 않다고 가정되어있나 보네요. 아니면 겹치는 데이터들이 있으면 가장 먼저 등록된 걸 리턴하거나..
int i;
int goodsIndexFound = -1;
for (int i=0; i<g.length; i++) {
if (g[i].getgCode().equals(gCode)) {
goodsIndexFound = i;
break;
}
}
if (goodsIndexFound == -1) {
throw new GoodsNotFoundException("입력하신 코드에 맞는 상품이 없습니다!");
}
3)
if(money>=1000000 && vip == false) {
상수 쓰지마시고..
private static final int VIP_POINT_THRESHOLD = 1000000;
if(money >= VIP_POINT_THRESHOLD && isVIP == false) {
이런식으로..
1) 변수명..
private static void sell(String gCode, String subTel, int su) {
이런식으로 쓰지 마시구요
private static void sellGoods(String goodsCode, String lineNumber, int buyingCount)
리팩토링은 함수명 변수명만 잘지어도 반은 먹고들어갑니다.
2)
int i, gIndex, cIndex;
for (i = 0; i < g.length; i++) {
if (g[i].getgCode().equals(gCode)) {
break;
}
}
if (i == g.length) {
System.out.println("상품코드가 잘못 되었습니다");
return;
}
gIndex = i; // 상품이 가르키는 곳의 인덱스
이렇게 하지 마시고.. for문 iterator로 쓰는 변수를 for문 밖에서 쓰는건 좋은 습관은 아니에요.
아마 문제에서 번호가 겹치는 데이터가 2개 이상 있지는 않다고 가정되어있나 보네요. 아니면 겹치는 데이터들이 있으면 가장 먼저 등록된 걸 리턴하거나..
int i;
int goodsIndexFound = -1;
for (int i=0; i<g.length; i++) {
if (g[i].getgCode().equals(gCode)) {
goodsIndexFound = i;
break;
}
}
if (goodsIndexFound == -1) {
throw new GoodsNotFoundException("입력하신 코드에 맞는 상품이 없습니다!");
}
3)
if(money>=1000000 && vip == false) {
상수 쓰지마시고..
private static final int VIP_POINT_THRESHOLD = 1000000;
if(money >= VIP_POINT_THRESHOLD && isVIP == false) {
이런식으로..
Warning: Use of undefined constant level - assumed 'level' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 158
Warning: Use of undefined constant password - assumed 'password' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 166
Warning: Use of undefined constant vote - assumed 'vote' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 171
Warning: Use of undefined constant vote - assumed 'vote' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 172
Warning: Use of undefined constant vote - assumed 'vote' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 172
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 173
Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 173
Warning: Use of undefined constant vote - assumed 'vote' (this will throw an Error in a future version of PHP) in /home/redtea/html/a_skin/bbsd/view_comment.php on line 173
30407>
30407>