主题:Qbasic 请求帮助
我们老师给我们发了一项作业,但我试了很久也没有搞出来。 请各位大侠帮帮忙,搞一下啊, 谢谢
搞出来后传到我Email上chirdis@126.com
谢谢
下面是问题:
Assignment #1: The Bank Machine
Overview: You are to simulate an automatic teller machine (ATM) for an imaginary bank.
*************************************************************************
* *
* The Bank of Bob *
* *
* *
* 1. Deposit *
* 2. Withdraw *
* 3. Balance *
* 4. Quit *
* *
* Please enter an option now: 4 *
* *
*************************************************************************
Specifics:
1. You do not have to call your bank “The Bank of Bob”. In fact, you are not allowed to call your bank the Bank of Bob. Pick another name.
2. Your simulation must include:
• a main screen with the following menu:
1. deposit
2. withdraw
3. balance
4. exit
• an exit screen (i.e. “Thank you for using bank of BOB!”)
• a login screen with a pin entry. Your PIN code should be 12345. Don’t get creative and change it so I have to guess your pin number! Don’t worry, you won’t be losing any real money – this is just a simulation. The user is allowed THREE TRIES to enter the PIN before it gets the boot.
3. Each option (deposit, withdraw, balance, quit) should be on its own screen, coloured and centred with a border.
4. You will need to follow these restrictions:
• Deposit: Do not accept negatives (a deposit of ZERO is OK)
• Withdraw: Do not accept negatives (zero ok)
Only accept multiples of $20
Cannot overdraw (can’t take out more than you have)
Cannot draw more than $500 from account at one time
Final notes:
• The client should be given an initial balance of $600.
• The program should loop back to the main menu after each option, except when they choose to quit.
Marks will be given for
* function (does it work smoothly)
* presentation (menus are centered properly)
* creativity (use of colour, decorative borders, etc)
* code form – proper indents, good variable names, program header, comments
DUE DATE: Roughly next Wed at end of class. This gives you one whole week.
What you will need
Before you begin, you will need to understand the following functions:
1. Color -- this function changes the color of the text
Example: COLOR 14 ‘use a yellow pen
2. Locate -- this function puts the cursor at row, col
Example: Locate 2, 10 ‘puts the cursor on the 2nd row, 10th column.
Note: The text screen is 80 columns by 20 rows, approximately.
3. PRINT USING -- this sets the format of the next print statement
Example: PRINT USING “$####.##”; 5 ‘ will print $5.00
This is useful when printing out dollar amounts. For example:
PRINT 100/3
Will print 33.333333333...
PRINT USING “$##.##”; 100/3
Will print $33.33
4. SLEEP -- this function pauses the program for a given number of seconds.
Example: SLEEP 3 ‘pauses for 3 seconds.
Keep in mind, 3 seconds is a long……………………………time!
5. MOD -- You will need this operator to determine if a withdrawal is a multiple of $20.
IF variable MOD 20 = 0 THEN
搞出来后传到我Email上chirdis@126.com
谢谢
下面是问题:
Assignment #1: The Bank Machine
Overview: You are to simulate an automatic teller machine (ATM) for an imaginary bank.
*************************************************************************
* *
* The Bank of Bob *
* *
* *
* 1. Deposit *
* 2. Withdraw *
* 3. Balance *
* 4. Quit *
* *
* Please enter an option now: 4 *
* *
*************************************************************************
Specifics:
1. You do not have to call your bank “The Bank of Bob”. In fact, you are not allowed to call your bank the Bank of Bob. Pick another name.
2. Your simulation must include:
• a main screen with the following menu:
1. deposit
2. withdraw
3. balance
4. exit
• an exit screen (i.e. “Thank you for using bank of BOB!”)
• a login screen with a pin entry. Your PIN code should be 12345. Don’t get creative and change it so I have to guess your pin number! Don’t worry, you won’t be losing any real money – this is just a simulation. The user is allowed THREE TRIES to enter the PIN before it gets the boot.
3. Each option (deposit, withdraw, balance, quit) should be on its own screen, coloured and centred with a border.
4. You will need to follow these restrictions:
• Deposit: Do not accept negatives (a deposit of ZERO is OK)
• Withdraw: Do not accept negatives (zero ok)
Only accept multiples of $20
Cannot overdraw (can’t take out more than you have)
Cannot draw more than $500 from account at one time
Final notes:
• The client should be given an initial balance of $600.
• The program should loop back to the main menu after each option, except when they choose to quit.
Marks will be given for
* function (does it work smoothly)
* presentation (menus are centered properly)
* creativity (use of colour, decorative borders, etc)
* code form – proper indents, good variable names, program header, comments
DUE DATE: Roughly next Wed at end of class. This gives you one whole week.
What you will need
Before you begin, you will need to understand the following functions:
1. Color -- this function changes the color of the text
Example: COLOR 14 ‘use a yellow pen
2. Locate -- this function puts the cursor at row, col
Example: Locate 2, 10 ‘puts the cursor on the 2nd row, 10th column.
Note: The text screen is 80 columns by 20 rows, approximately.
3. PRINT USING -- this sets the format of the next print statement
Example: PRINT USING “$####.##”; 5 ‘ will print $5.00
This is useful when printing out dollar amounts. For example:
PRINT 100/3
Will print 33.333333333...
PRINT USING “$##.##”; 100/3
Will print $33.33
4. SLEEP -- this function pauses the program for a given number of seconds.
Example: SLEEP 3 ‘pauses for 3 seconds.
Keep in mind, 3 seconds is a long……………………………time!
5. MOD -- You will need this operator to determine if a withdrawal is a multiple of $20.
IF variable MOD 20 = 0 THEN