목차
1. 서론(Introduction)
2. 전체 기술(Overall Description)
2.1 프로젝트 제약조건(Projuct Constraints)
2.2 기능 기술(Functional Description)
3. 정보 기술(Information Description)
4. 사용자 메뉴얼(User Manual)
5. 검증 기준(Validtion Criteria)
6. 기능이 아닌 요구사항(Nonfunctional Requirements)
등
2. 전체 기술(Overall Description)
2.1 프로젝트 제약조건(Projuct Constraints)
2.2 기능 기술(Functional Description)
3. 정보 기술(Information Description)
4. 사용자 메뉴얼(User Manual)
5. 검증 기준(Validtion Criteria)
6. 기능이 아닌 요구사항(Nonfunctional Requirements)
등
본문내용
class User // 사용자 객체
{
public :
int Coin;
void Input_Coin(int x)
{
Coin=0;
Coin = Coin + x;
cout << "당신이 넣은신 금액은 " << Coin <<"입니다." << endl;
}
};
class Vending // 자판기 객체
{
public :
int set_coin, in_coin, cur_coin, number;
char *name;
void set_vending(char *a, int b) // 음료명 표시 및 수량 표시
{
name = new char[strlen(a) + 1];
strcpy(name, a);
number = b;
}
void after_coin(int x, int y) // 금액을 계산
{
set_coin = set_coin - y;
cout << "현재 남아있는 금액은 " << set_coin <<"입니다." << endl;
}
void Err_Dis() // 금액 부족시 에러 메시지
{
cout << "금액이 부족합니다." <
void Display() // 음료 출력 및 시현
{
cout << "** " << name << " **" << "나왔습니다." << endl;
cout << name << "의 남은 수량은"<< number << "입니다." << endl;
}
void return_coin() // 잔돈 반환
{
cout << "잔돈 " << set_coin << "이 나왔습니다." << endl;
}
void all_in() // 금액 부족시 메시지
{
cout << "더이상 음료를 선택하실수 없습니다. (수량 0)" << endl;
}
};
void main()
{
Vending test;
User test_2;
int Select_Menu, Input_Coin, Two=5, Sa=5, Coke=5, Han=5;
cout << "금액을 투입 하세요 : ";
cin >> Input_Coin;
test_2.Input_Coin(Input_Coin);
test.set_coin = Input_Coin;
while(1){
cout << endl <<"메뉴를 선택 하세요!!" << endl;
cout << endl <<"1) 2% (250원)2) 사이다 (300원)3) 콜라 (300원)4) 환타 (400원)5) 잔돈반환" << endl;
cin >> Select_Menu;
switch(Select_Menu) {
case 1 : if(Two == 0) {test.all_in(); }
if(test.set_coin < 250) {test.Err_Dis(); break; }
test.set_vending("2%", Two);
test.Display();
test.after_coin(test.set_coin, 250);
Two--;
break;
case 2 : if(Sa == 0) {test.all_in(); }
if(test.set_coin < 300) {test.Err_Dis(); break; }
test.set_vending("사이다", Sa);
test.Display();
test.after_coin(test.set_coin, 300);
Sa--;
break;
case 3 : if(Coke == 0) { test.all_in(); }
if(test.set_coin < 300) {test.Err_Dis(); break; }
test.set_vending("콜라", Coke);
test.Display();
test.after_coin(test.set_coin, 300);
Coke--;
break;
case 4 : if(Han == 0) {test.all_in(); }
if(test.set_coin < 300) {test.Err_Dis(); break; }
test.set_vending("환타", Han);
test.Display();
test.after_coin(test.set_coin, 300);
Han--;
break;
case 5 : test.return_coin();
exit(1);
}
}
}
결과 화면
1. 금액 투입 -> 음료 선택 -> 잔액 시현 -> 잔돈 반환 의 순차적인 결과
2. 금액 투입 -> 음료 선택 -> 잔액 시현 -> 음료선택 -> 잔액부족 -> 잔돈반환의 순차적인 결과
2. 금액 투입 -> 음료 선택 -> 음료선택 -> ... -> 음료선택 -> 수량부족 -> 잔돈반환의 순차적인 결과
소개글