update,
This commit is contained in:
7
gitUpdate.bat
Normal file
7
gitUpdate.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
git status .
|
||||
|
||||
@pause
|
||||
|
||||
git add .
|
||||
git commit -m"update ifkcof,"
|
||||
start git push
|
9
meta.md
Normal file
9
meta.md
Normal file
@@ -0,0 +1,9 @@
|
||||
UXMPX
|
||||
|
||||
好,多謝你先
|
||||
初次見面,你介唔介意落個 HKD100 訂嘛?
|
||||
|
||||
### balance history
|
||||
|
||||
HKD300 -> quote accepted
|
||||
HKD100 deposit received
|
BIN
task1/EA Project_ITE3919_Programming Essentials in Python.docx
Normal file
BIN
task1/EA Project_ITE3919_Programming Essentials in Python.docx
Normal file
Binary file not shown.
265
task1/digest.md
Normal file
265
task1/digest.md
Normal file
@@ -0,0 +1,265 @@
|
||||
---
|
||||
Hong Kong Institute of Vocational Education
|
||||
ITE3919 – Programming Essentials in Python
|
||||
AY2324
|
||||
Mini Project: Investment Banking System (IBS)
|
||||
---
|
||||
|
||||
# Digest
|
||||
|
||||
## 1. Description
|
||||
|
||||
In this project, you are required to complete the following parts:
|
||||
Part 1: Pseudo code of the first function "Converting Euro or USD to HKD"
|
||||
Part 2: The coding in Python acceptable style of all 3 functions of Investment Banking System (IBS):
|
||||
|
||||
- Converting Euro or USD to HKD
|
||||
- Calculating the minimum number of coins
|
||||
- Calculating the total amount of principle and compound interest
|
||||
|
||||
Coding of system menu is provided to you in this file. You need to copy the code to the source file / online simulator:
|
||||
|
||||
[https://edube.org/sandbox](https://edube.org/sandbox)
|
||||
|
||||
Copy and paste your work into the provided MS word file `EA Project*Answer Sheet*<<Your Name>>.docx` (e.g. `EA Project_Answer Sheet_ChanTaiMan.docx`) and upload to Moodle.
|
||||
|
||||
## 2. Background
|
||||
|
||||
VTC Bank it is a local investment bank in Hong Kong. In order to attract investments from foreign cities, VTC Bank is planning to develop a program to provide the following services:
|
||||
|
||||
- Providing a currency converter;
|
||||
- Introducing the coins issued in Hong Kong; and
|
||||
- Providing compound interest calculator.
|
||||
|
||||
Assuming you are the programmer of VTC Bank, your manager asks you to develop the program.
|
||||
|
||||
## 3. IBS Structure
|
||||
|
||||
There are 3 functions of IBS:
|
||||
|
||||
- Converting Euro and US dollars to Hong Kong Dollar;
|
||||
- Calculating the minimum number of coins for corresponding amounts of dollars;
|
||||
- Calculating the total amount of principle and compound interest
|
||||
|
||||
### 3.1. Show menu
|
||||
|
||||
At the beginning, the program should show a menu. The user input a number to use a particular function. The following table shows the number and function mapping:
|
||||
|
||||
| Number | Function |
|
||||
| :----: | --------------------------------------------------------------- |
|
||||
| 1 | Converting Euro or USD to HKD |
|
||||
| 2 | Calculating the minimum number of coins |
|
||||
| 3 | Calculating the total amount of principle and compound interest |
|
||||
| 4 | Quit the system |
|
||||
|
||||
> _Assume the user will input valid number (i.e. 1, 2, 3 or 4), this part is already done for you._
|
||||
|
||||
### 3.2. Go back to menu or continue
|
||||
|
||||
After every function is finished (except quit the system), the program should show the menu again and ask user to choose a function.
|
||||
|
||||
> _\*This part is already done for you._
|
||||
|
||||
## 4. IBS Functions
|
||||
|
||||
### 4.1. Converting Euro or USD to HKD
|
||||
|
||||
When user chooses this function, user can convert Euro or USD to HKD. User inputs strings "Euro" or "USD" to choose to convert Euro to HKD or USD to HKD respectively. Then, the program asks the user to input the amount of Euro or USD. After the users input the amount, the program shows the amount of HKD.
|
||||
|
||||
> _\*Assume the user will input valid strings (i.e. "Euro" and "USD")_
|
||||
|
||||
### 4.2. Calculating the minimum number of coins
|
||||
|
||||
When user chooses this function, the program calculates the minimum number of coins for corresponding amounts of dollars. User inputs an amount, then the program shows the minimum number of 10-dollar coins, 5-dollar coins, 2-dollar coins and 1-dollar coins.
|
||||
|
||||
### 4.3. Calculating the total amount of principle and compound interest
|
||||
|
||||
When user chooses this function, the program calculates the compound interest based on the inputted principle, interest rate and number of years compounded. User inputs principle, interest rate and number of years compounded, the program shows the total amount of principle and compound interest.
|
||||
|
||||
> _You have to use while loop to finish this function. Otherwise, marks will be deducted._
|
||||
|
||||
## 5. Sample input and output
|
||||
|
||||
All user inputs are bolded and underlined.
|
||||
|
||||
### 1. When program starts, the program shows the menu (this part is already done for you)
|
||||
|
||||
```bash
|
||||
Welcome to IBS! Please choose one of the following functions
|
||||
1. Converting Euro or USD to HKD
|
||||
2. Calculating the minimum number of coins
|
||||
3. Calculating the total amount of principle and compound interest
|
||||
4. Quit
|
||||
```
|
||||
|
||||
### 2. Convert Euro or USD to HKD
|
||||
|
||||
```bash
|
||||
Welcome to IBS! Please choose one of the following functions
|
||||
|
||||
1. Converting Euro or USD to HKD
|
||||
2. Calculating the minimum number of coins
|
||||
3. Calculating the total amount of principle and compound interest
|
||||
4. Quit
|
||||
1
|
||||
Currency to be converted to HKD (Euro / USD): Euro
|
||||
Amount to be converted: 10000
|
||||
10000.0 Euro = 80200.0 HKD
|
||||
```
|
||||
|
||||
### 3. Calculate the minimum number of coins
|
||||
|
||||
```bash
|
||||
Welcome to IBS! Please choose one of the following functions
|
||||
1. Converting Euro or USD to HKD
|
||||
2. Calculating the minimum number of coins
|
||||
3. Calculating the total amount of principle and compound interest
|
||||
4. Quit
|
||||
2
|
||||
Input an amount: 28
|
||||
The minimum numbers of coins for 21 dollars are:
|
||||
10-dollar coin(s): 2
|
||||
5-dollar coin(s): 1
|
||||
2-dollar coin(s): 1
|
||||
1-dollar coin(s): 1
|
||||
```
|
||||
|
||||
> **HINTS:**
|
||||
>
|
||||
> - Use the division (/) and remainder (%) operators.
|
||||
> - The inputted amount should be an integer.
|
||||
|
||||
### 4. Calculating the total amount of principle and compound interest
|
||||
|
||||
```bash
|
||||
Welcome to IBS! Please choose one of the following functions
|
||||
|
||||
1. Converting Euro or USD to HKD
|
||||
2. Calculating the minimum number of coins
|
||||
3. Calculating the total amount of principle and compound interest
|
||||
4. Quit
|
||||
3
|
||||
Input principle: 10000
|
||||
Input interest rate: 0.05
|
||||
Input number of years compounded: 4
|
||||
The total amount of principle and compound interest: 12155.0625
|
||||
```
|
||||
|
||||
> **HINTS:**
|
||||
>
|
||||
> - The inputted number of years should be integer.
|
||||
> - Use while loop to finish this function.
|
||||
|
||||
### 5. Quit the system (this part is already done for you)
|
||||
|
||||
```bash
|
||||
Welcome to IBS! Please choose one of the following functions
|
||||
1. Converting Euro or USD to HKD
|
||||
2. Calculating the minimum number of coins
|
||||
3. Calculating the total amount of principle and compound interest
|
||||
4. Quit
|
||||
4
|
||||
Thanks for using IBS! Bye!
|
||||
```
|
||||
|
||||
## 6. Hints
|
||||
|
||||
- Use input() to get user input, for example:
|
||||
|
||||
```bash
|
||||
name = input("Enter your name:");
|
||||
# variable "name" will store the string inputted by user
|
||||
```
|
||||
|
||||
- Use int() & input() to get user input and convert the datatype from string to integer, for example:
|
||||
|
||||
```bash
|
||||
amount = int(input("Enter an integer value:"));
|
||||
# variable "amount" will store the integer inputted by user
|
||||
```
|
||||
|
||||
- Use float() & input() to get user input and convert the datatype from string to floating-point number, for example:
|
||||
|
||||
```bash
|
||||
amount = float(input("Enter an floating-point value:"));
|
||||
# variable "amount" will store the floating-point number inputted by user
|
||||
```
|
||||
|
||||
## 7. Assumption
|
||||
|
||||
- All user inputs are valid.
|
||||
- You should copy the following code to the source file / online simulator to start your work. You are required to add codes of functions 1, 2 and 3 into the program.
|
||||
|
||||
```python
|
||||
"""
|
||||
ITE3919 - Programming Essentials in Python (Mini Project)
|
||||
Student Name: <<Your Name>>
|
||||
Student No: <<Your Student No.>>
|
||||
"""
|
||||
EURO_RATE = 8.02
|
||||
USD_RATE = 7.75
|
||||
|
||||
while True:
|
||||
print("Welcome to IBS! Please choose one of the following functions")
|
||||
print("1. Converting Euro or USD to HKD")
|
||||
print("2. Calculating the minimum number of coins")
|
||||
print("3. Calculating the total amount of principle and compound interest")
|
||||
print("4. Quit")
|
||||
|
||||
command = input()
|
||||
|
||||
if command == "1":
|
||||
# add your code of Function 1 here
|
||||
|
||||
elif command == "2":
|
||||
# add your code of Function 2 here
|
||||
|
||||
elif command == "3":
|
||||
# add your code of Function 3 here
|
||||
|
||||
elif command == "4":
|
||||
print("Thanks for using IBS! Bye!")
|
||||
break
|
||||
```
|
||||
|
||||
## 8. Marking Criteria
|
||||
|
||||
| Criteria | Proportion |
|
||||
| --------------------------------------------------------------------------- | :--------: |
|
||||
| Pseudo Code of Function 1 | 10% |
|
||||
| Function 1: Converting Euro or USD to HKD | 10% |
|
||||
| Function 2: Calculating the minimum number of coins | 10% |
|
||||
| Function 3: Calculating the total amount of principle and compound interest | 5% |
|
||||
| Program Style and Design | 5% |
|
||||
|
||||
## 9. Deadline
|
||||
|
||||
The deadline of this assignment is `DD/MMM/YYYY (WWW) HH:MM` **(GMT+8) according to Hong Kong Observatory Time**.
|
||||
|
||||
## 10. Submission Guideline
|
||||
|
||||
```python
|
||||
"""
|
||||
ITE3919 - Programming Essentials in Python (Mini Project)
|
||||
Student Name:<<Your Name>>
|
||||
Student No:<<Your Student No>>
|
||||
"""
|
||||
```
|
||||
|
||||
✔️ Add the following information as comment at the beginning of your source code:
|
||||
|
||||
✔️ Copy your source code from source file / online simulator to provided word file `EA Project*Answer Sheet*<<Your Name>>.docx` (e.g. `EA Project_Answer Sheet_ChanTaiMan.docx`)
|
||||
|
||||
✔️ Submit the word file to Moodle
|
||||
|
||||
✔️ For students who doesn’t follow the file name format, **marks will be deducted**
|
||||
|
||||
## 11. Remarks
|
||||
|
||||
✔️ This assignment worth 40% of the total course masrk
|
||||
|
||||
✔️ This is an individual assignment. No collaboration work is allowed
|
||||
|
||||
✔️ Plagiarism will be **SERIOUSLY PUNISHED**. All the plagiarism assignment will **receive 0 marks**
|
||||
|
||||
✔️ Enjoy your work
|
3
task1/gitUpdate.bat
Normal file
3
task1/gitUpdate.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
git add .
|
||||
git commit -m"update ifkcof,"
|
||||
start git push
|
103
task1/src/main.py
Normal file
103
task1/src/main.py
Normal file
@@ -0,0 +1,103 @@
|
||||
"""
|
||||
ITE3919 - Programming Essentials in Python (Mini Project)
|
||||
Student Name: <<Your Name>>
|
||||
Student No: <<Your Student No.>>
|
||||
"""
|
||||
EURO_RATE = 8.02
|
||||
USD_RATE = 7.75
|
||||
|
||||
|
||||
# from docx,
|
||||
# Assumption
|
||||
# - All user inputs are valid.
|
||||
|
||||
while True:
|
||||
print("Welcome to IBS! Please choose one of the following functions")
|
||||
print("1. Converting Euro or USD to HKD")
|
||||
print("2. Calculating the minimum number of coins")
|
||||
print("3. Calculating the total amount of principle and compound interest")
|
||||
print("4. Quit")
|
||||
|
||||
command = input()
|
||||
|
||||
if command == "1":
|
||||
# add your code of Function 1 here
|
||||
# Converting Euro and US dollars to Hong Kong Dollar
|
||||
# When user chooses this function, user can convert Euro or USD to HKD.
|
||||
# User inputs strings "Euro" or "USD" to choose to convert Euro to HKD or USD to HKD respectively. Then, the program asks the user to input the amount of Euro or USD.
|
||||
# After the users input the amount, the program shows the amount of HKD.
|
||||
|
||||
# Assume the user will input valid strings (i.e. "Euro" and "USD")
|
||||
print("Currency to be converted to HKD (Euro / USD): " , end="")
|
||||
currency = input()
|
||||
|
||||
print("Amount to be converted: " , end="")
|
||||
amount = float(input())
|
||||
|
||||
# init converted amount
|
||||
converted_amount = amount
|
||||
|
||||
# from Docx, Assume the user will input valid strings (i.e. "Euro" and "USD")
|
||||
if currency == "Euro":
|
||||
converted_amount = float(amount) * EURO_RATE
|
||||
else:
|
||||
converted_amount = float(amount) * USD_RATE
|
||||
|
||||
print("{:.1f} {} = {:.1f} HKD".format(float(amount), currency, float(converted_amount)))
|
||||
|
||||
elif command == "2":
|
||||
# add your code of Function 2 here
|
||||
# Calculating the minimum number of coins for corresponding amounts of dollars
|
||||
# When user chooses this function, the program calculates the minimum number of coins for corresponding amounts of dollars.
|
||||
# User inputs an amount, then the program shows the minimum number of 10-dollar coins, 5-dollar coins, 2-dollar coins and 1-dollar coins.
|
||||
|
||||
print("Input an amount: ", end="")
|
||||
amount = int(input())
|
||||
|
||||
print("The minimum numbers of coins for {} dollars are: ".format(amount))
|
||||
|
||||
# number of coins = quotient get divided by 10
|
||||
ten_dollar_coins = amount // 10
|
||||
remaining_amount = (amount - (ten_dollar_coins * 10))
|
||||
|
||||
# number of coins = quotient get divided by 5
|
||||
five_dollar_coins = remaining_amount // 5
|
||||
remaining_amount = (remaining_amount - (five_dollar_coins * 5))
|
||||
|
||||
# number of coins = quotient get divided by 2
|
||||
two_dollar_coins = remaining_amount // 2
|
||||
remaining_amount = (remaining_amount - (two_dollar_coins * 2))
|
||||
|
||||
one_dollar_coins = remaining_amount
|
||||
|
||||
print("10-dollar coin(s): {}".format(ten_dollar_coins))
|
||||
print("5-dollar coin(s): {}".format(five_dollar_coins))
|
||||
print("2-dollar coin(s): {}".format(two_dollar_coins))
|
||||
print("1-dollar coin(s): {}".format(one_dollar_coins))
|
||||
|
||||
elif command == "3":
|
||||
# add your code of Function 3 here
|
||||
# Calculating the total amount of principle and compound interest
|
||||
|
||||
# When user chooses this function, the program calculates the compound interest based on the inputted principle, interest rate and number of years compounded.
|
||||
# User inputs principle, interest rate and number of years compounded, the program shows the total amount of principle and compound interest.
|
||||
|
||||
print("Input principle: ", end="")
|
||||
principle = float(input())
|
||||
|
||||
print("Input interest rate: ", end="")
|
||||
intrest_rate = float(input())
|
||||
|
||||
print("Input number of years compounded: ", end="")
|
||||
years = int(input())
|
||||
|
||||
# init total amount
|
||||
total_amount = principle
|
||||
for i in range(0, years):
|
||||
total_amount = total_amount + (total_amount * (intrest_rate))
|
||||
|
||||
print("The total amount of principle and compound interest: {}".format(total_amount))
|
||||
|
||||
elif command == "4":
|
||||
print("Thanks for using IBS! Bye!")
|
||||
break
|
Reference in New Issue
Block a user