수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

오류수정좀 부탁합니다. vector가 이상하다네요

볼수록중독

2023.04.01

import java.io.*;
import java.util.*;

class SeoulBankSystem
{
static Vector objInfo;
static AccountInfo accinfo;
boolean isContinue = true;
public static void main(String[] args)
{
objInfo = new Vector(4); // Account 인스턴스 정보

TimeCount tc = new TimeCount(objInfo);
accinfo = tc.getAccountInfo();

while(true){
System.out.println(\n);
System.out.println(+======================================================+);
System.out.println(| 1.입금2.출금3.계좌정보4.이자 및 수수료5.종료 |);
System.out.println(+======================================================+);
System.out.println(Input Number: );

try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = in.readLine();
int input = Integer.parseInt(str);
switch(input){
case 1:
receiptsMoney(getAccountNumber());
break;
case 2:
payMoney(getAccountNumber());
break;
case 3:
AccountAllInfo();
break;
case 4:
&nbnbsp;setLoanNCommission();
break;
case 5:
System.out.println(Exiting....);
System.exit(0);
break;

}

Thread.sleep(1000); //1초
}catch(Exception e){}

}

}

public static void AccountAllInfo(){
Account acc;
int size = objInfo.size();

if(size =0){
System.out.println(생성된 계좌가 없습니다!!);
return;
}
for(int i=0;isize;i++){
acc = (Account)objInfo.elementAt(i);
if(i == 0){
System.out.println(저축계좌: + accinfo.SavingAccountNumber+ 개, 당좌계좌: +accinfo.CurrentAccountNumber+ 개);
}
System.out.println(종류: +acc.AccountName+, 계좌번호: +acc.startID+, 예치금: +acc.deposit);
}
}
public static int getAccountNumber(){
int number=0;
try{
System.out.println(계좌 번호(숫자)를 입력하시오: );
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = in.readLine();
number = Integer.parseInt(str);
}catch(Exception se){
System.out.println(se);
}
return number;
}
public static void receiptsMoney(int number){
long amoney=0;
Account acc;
boolean isCA= false;
try{
System.out.println(입금액(숫자)을 입력하시오: );
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = in.readLine();
amoney = Long.parseLong(str);
}catch(Exception se){
System.out.println(se);
}

int size = objInfo.size();

if(size =0){
p;System.out.println(생성된 계좌가 없습니다!!);
return;
}
for(int i=0;isize;i++){
acc = (Account)objInfo.elementAt(i);
if(acc.startID == number){
if(acc.AccountName.equals(당좌계좌)){
acc.deposit -=1000; // 매매가 수수료
isCA = true;
}
acc.deposit += amoney;
if(isCA){
System.out.println(총액: +acc.deposit+, 입금액: +amoney+, 수수료: 1000원 부과);
}
else
System.out.println(총액: +acc.deposit+, 입금액: +amoney);
}
}
}

public static void payMoney(int number){
long amoney=0;
Account acc;
boolean isCA = false;
try{
System.out.println(출금액(숫자)을 입력하시오: );
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = in.readLine();
amoney = Long.parseLong(str);
}catch(Exception se){
System.out.println(se);
}

int size = objInfo.size();

if(size =0){
System.out.println(생성된 계좌가 없습니다!!);
return;
}
for(int i=0;isize;i++){
acc = (Account)objInfo.elementAt(i);
if(acc.startID == number){
if(acc.AccountName.equals(당좌계좌)){
acc.deposit -=1000; // 매매가 수수료
isCA = true;
}
acc.deposit -= amoney;
if(isCA){
System.out.println(총액: +acc.deposit+, 출금액: +amoney+, 수수료: 1000원 부과);
}
else
 sp;System.out.println(총액: +acc.deposit+, 출금액: +amoney);
}
}
}
public static void setLoanNCommission(){

Account acc;
float loan;
int size = objInfo.size();
if(size =0){
System.out.println(생성된 계좌가 없습니다!!);
return;
}
for(int i=0;isize;i++){
acc = (Account)objInfo.elementAt(i);

if(acc.AccountName.equals(저축계좌)){
loan = acc.deposit * acc.bankrate;
acc.deposit +=(long)loan;

if(acc.deposit acc.rulemoney){
acc.deposit -=25000; //수수료 부과
if(acc.deposit 0)acc.deposit = 0;
System.out.println(계좌번호: +acc.startID+, 총액: +acc.deposit+, 이자: +(long)loan+, 수수료: 25000 부과됨);
}
else{
System.out.println(계좌번호: +acc.startID+, 총액: +acc.deposit+, 이자: +(long)loan+, 수수료: 해당사항 없음);
}

}
else if(acc.AccountName.equals(당좌계좌)){
loan = acc.deposit * acc.bankrate;
//acc.deposit +=(long)loan;

if(acc.deposit acc.rulemoney){
acc.deposit +=(long)loan; //이자 부과
System.out.println(계좌번호: +acc.startID+, 총액: +acc.deposit+, 이자: +(long)loan);
}
else
System.out.println(계좌번호: +acc.startID+, 총액: +acc.deposit+, 이자: 없음);
}
else
System.out.println(해당 계좌 없습니다!);
}
}

}
class AccountInfo
{
static int CurrentAccountNumber;
static int SavingAccountNumber;

};

class Account
{
long rulemoney;
long deposit;
long startID;
float bankrate= 0.0f;
String AccountName=;

Account(){
//CurrentAccountNumber = SavingAccountNumber = 0;
&nbnbsp;deposit = startID = 0;
}

public long generateDeposit(int type){
long money=0;

if(type == 1){ //저축예금
// 1 ~ 20만원까지의 수를 생성
money = (long)(Math.random() * (100000 * 2)) + 1;
}
else if(type ==2){ //당좌예금
// 1 ~ 500만원까지의 수를 생성
money = (long)(Math.random() * (2500000 * 2)) + 1;
}
return money;
}

};
class CurrentAccount extends Account
{
CurrentAccount(int type){
startID= 500001;
rulemoney = 2500000;
AccountName=당좌계좌;
deposit = generateDeposit(type);
}

};

class SavingAccount extends Account
{
SavingAccount(int type){
startID= 1;
rulemoney = 100000;
AccountName =저축계좌;
deposit = generateDeposit(type);
}
};

class TimeCount extends Thread
{
int time = 0;
//int
//int period = 3600;// 1시간마다 계좌 생성
int period = 10; //임시로 만듬
Vector vInfo;
Account acc;
AccountInfo accinfo;
TimeCount(Vector vInfo){
this.vInfo = vInfo;
accinfo = new AccountInfo();
start();
}

public void run(){
int type=1;
type = (int)(Math.random() * 2) + 1;
//계좌생성
if(type == 1){
vInfo.addElement(acc = new SavingAccount(type));
acc.startID +=accinfo.SavingAccountNumber;
accinfo.SavingAccountNumber++;
System.out.println(저축 계좌가 생성됨!);
}
if(type ==2){
vInfo.addElement(acc = new CurrentAccount(type));
acc.startID +=accinfo.CurrentAccountNumber;
accinfo.CurrentAccountNumber++;
System.out.println(당좌 계좌가 생성됨!);
}
while(true){
try{
time++;
if(time == period ){ // 1시간이 되면
type = (int)(Math.random() * 2) + 1;
//계좌생성
if(type == 1){
vInfo.addElement(acc = new SavingAccount(type));
p;acc.startID +=accinfo.SavingAccountNumber;
accinfo.SavingAccountNumber++;
acc.bankrate = 0.05f; //연이율
System.out.println(저축 계좌가 생성됨!);
}
if(type ==2){
vInfo.addElement(acc = new CurrentAccount(type));
acc.startID +=accinfo.CurrentAccountNumber;
accinfo.CurrentAccountNumber++;
acc.bankrate = 0.025f; //연이율
System.out.println(당좌 계좌가 생성됨!);
}
if(time == period)time = 0;
}
Thread.sleep(1000); //1초
}catch(InterruptedException e){}
}

}
public AccountInfo getAccountInfo(){
return accinfo;
}
};

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

번호 제 목 글쓴이 날짜
2694894 웹 프로그래밍 관련해서 질문합니다. 창의적 2025-05-15
2694868 컨택트 폼 7에서 textarea 높이 조정 영글 2025-05-15
2694818 line-height값이 적용이 안되는데 왜 그런 거예요?. letter-spacing,line-height의 기준?? (2) 풍란 2025-05-14
2694795 이것 어떻게 좀 해결좀;; (3) 개럭시 2025-05-14
2694724 코딩시 폰트 문제; ㅠ 후력 2025-05-13
2694696 텍스트박스 입력에 관한 문제입니다. 딥공감 2025-05-13
2694668 [질문] 페이퍼비전 PointLight 관련 질문 드려요.. 두바다찬솔 2025-05-13
2694611 Flash Lite 2.1에서 BitmapData와 Matrix 지원안하나요? (3) 이플 2025-05-12
2694582 IE & 파이어폭스 (2) 흙이랑 2025-05-12
2694553 무비클립안의 duplicate 발동이 안돼네요; 딥보라 2025-05-12
2694523 자바 애플릿 질문좀 ^^ (6) 동이 2025-05-12
2694494 [질문] JAVA 또는 C++ 로 프로그램 개발시.. 레지스터리 등록 관련 의문점? (3) 우람늘 2025-05-11
2694469 익스6에서 css버그 나오는것 해결방법좀요 !!!! (6) 원술 2025-05-11
2694442 로컬에선 잘 나오는데 운영에 반영하면 이상하게 나와요. (8) 목화 2025-05-11
2694412 [질문] 이미지 로딩후 사이즈 조절할때 (1) 아담 2025-05-11
2694391 설치형 블로그 쓰시는 분들 어떤거 쓰세요?? (7) AngelsTears 2025-05-10
2694362 Microsoft SQL Server에서 서버만드는법 어둠 2025-05-10
2694333 for문으로 돌린 이름의 제어 (4) 레이 2025-05-10
2694308 이미지 css 도와주세요 ㅠㅠ (2) 애기 2025-05-10
2694223 [급질문]스크롤스파이의 offset값 진나 2025-05-09
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com